Disregard return value from Stream.on_data
authorHarmon <Harmon758@gmail.com>
Sun, 24 Jan 2021 13:57:04 +0000 (07:57 -0600)
committerHarmon <Harmon758@gmail.com>
Sun, 24 Jan 2021 13:57:04 +0000 (07:57 -0600)
tweepy/streaming.py

index bbc65ab014bc81eae4427f21daa3ac3369671439..405ebf2a0b2c69418246358e83b833eef7224ecf 100644 (file)
@@ -90,16 +90,17 @@ class Stream:
                             http_error_wait = http_error_wait_start
                             network_error_wait = network_error_wait_step
                             self.on_connect()
+                            if not self.running:
+                                break
 
                             for line in resp.iter_lines(
                                 chunk_size=self.chunk_size
                             ):
-                                if not self.running:
-                                    break
-                                if not line:
+                                if line:
+                                    self.on_data(line)
+                                else:
                                     self.on_keep_alive()
-                                elif self.on_data(line) is False:
-                                    self.running = False
+                                if not self.running:
                                     break
 
                             if resp.raw.closed:
@@ -217,7 +218,7 @@ class Stream:
         """Called when raw data is received from connection.
 
         Override this method if you wish to manually handle
-        the stream data. Return False to stop stream and close connection.
+        the stream data.
         """
         data = json.loads(raw_data)