Default Stream._start threaded parameter to False
authorHarmon <Harmon758@gmail.com>
Fri, 22 Jan 2021 18:50:16 +0000 (12:50 -0600)
committerHarmon <Harmon758@gmail.com>
Fri, 22 Jan 2021 18:50:16 +0000 (12:50 -0600)
Pass threaded as kwarg to Stream._start in Stream.filter and Stream.sample

tweepy/streaming.py

index dcf70049d8a53f74c928e2712fdc087e6c816056..405f9844976fc01ecc1b0ac99c4a9f562b0e5b79 100644 (file)
@@ -237,7 +237,7 @@ class Stream:
         if resp.raw.closed:
             self.on_closed(resp)
 
-    def _start(self, threaded, *args, **kwargs):
+    def _start(self, threaded=False, *args, **kwargs):
         self.running = True
         if threaded:
             self._thread = Thread(target=self._run, args=args, kwargs=kwargs)
@@ -259,7 +259,7 @@ class Stream:
             self.session.params['language'] = ','.join(map(str, languages))
         if stall_warnings:
             self.session.params['stall_warnings'] = 'true'
-        self._start(threaded)
+        self._start(threaded=threaded)
 
     def filter(self, follow=None, track=None, threaded=False, locations=None,
                stall_warnings=False, languages=None, encoding='utf8', filter_level=None):
@@ -284,7 +284,7 @@ class Stream:
         if filter_level:
             body['filter_level'] = filter_level.encode(encoding)
         self.session.params = {}
-        self._start(threaded, body=body)
+        self._start(body=body, threaded=threaded)
 
     def disconnect(self):
         self.running = False