Return thread when using threaded Stream.filter and Stream.sample
authorHarmon <Harmon758@gmail.com>
Sat, 23 Jan 2021 20:23:48 +0000 (14:23 -0600)
committerHarmon <Harmon758@gmail.com>
Sat, 23 Jan 2021 20:23:48 +0000 (14:23 -0600)
tweepy/streaming.py

index ece9fe2a1bf89feb63c3080d273ab6592867e573..0d5e74c167b03a9ebc7c1c1e601abcdd22415295 100644 (file)
@@ -230,6 +230,7 @@ class Stream:
         self.thread = Thread(target=self._connect, name="Tweepy Stream",
                              args=args, kwargs=kwargs, daemon=self.daemon)
         self.thread.start()
+        return self.thread
 
     def filter(self, *, follow=None, track=None, locations=None,
                filter_level=None, languages=None, stall_warnings=False,
@@ -257,7 +258,7 @@ class Stream:
             body['stall_warnings'] = stall_warnings
 
         if threaded:
-            self._threaded_connect(endpoint, body=body)
+            return self._threaded_connect(endpoint, body=body)
         else:
             self._connect(endpoint, body=body)
 
@@ -274,7 +275,7 @@ class Stream:
             params['stall_warnings'] = 'true'
 
         if threaded:
-            self._threaded_connect(endpoint, params=params)
+            return self._threaded_connect(endpoint, params=params)
         else:
             self._connect(endpoint, params=params)