Set Stream.running in Stream._connect instead of Stream._start
authorHarmon <Harmon758@gmail.com>
Sat, 23 Jan 2021 19:40:32 +0000 (13:40 -0600)
committerHarmon <Harmon758@gmail.com>
Sat, 23 Jan 2021 19:40:32 +0000 (13:40 -0600)
tweepy/streaming.py

index eac09e7843ad0165f9c187df964747ae13840d7d..a494c2e7adc881cd0d25ee8f40ff3c4d4bf8f7a0 100644 (file)
@@ -143,6 +143,8 @@ class Stream:
         self.session = None
 
     def _connect(self, endpoint, params=None, body=None):
+        self.running = True
+
         if self.session is None:
             self.session = requests.Session()
 
@@ -224,7 +226,6 @@ class Stream:
             self.running = False
 
     def _start(self, *args, threaded=False, **kwargs):
-        self.running = True
         if threaded:
             self._thread = Thread(target=self._connect, name="Tweepy Stream",
                                   args=args, kwargs=kwargs, daemon=self.daemon)