Remove Stream._data method
authorHarmon <Harmon758@gmail.com>
Mon, 4 Jan 2021 09:35:38 +0000 (03:35 -0600)
committerHarmon <Harmon758@gmail.com>
Mon, 4 Jan 2021 09:35:38 +0000 (03:35 -0600)
tweepy/streaming.py

index 36f18a40ef9d2986e5ece1d0ae4d46d74808a7c3..0907c885f58673e7e6ff3648dfe5f907fca0adfd 100644 (file)
@@ -273,10 +273,6 @@ class Stream:
                 resp.close()
             self.new_session()
 
-    def _data(self, data):
-        if self.listener.on_data(data) is False:
-            self.running = False
-
     def _read_loop(self, resp):
         charset = resp.headers.get('content-type', default='')
         enc_search = re.search(r'charset=(?P<enc>\S*)', charset)
@@ -302,7 +298,8 @@ class Stream:
 
             next_status_obj = buf.read_len(length)
             if self.running and next_status_obj:
-                self._data(next_status_obj)
+                if self.listener.on_data(next_status_obj) is False:
+                    self.running = False
 
             # # Note: keep-alive newlines might be inserted before each length value.
             # # read until we get a digit...
@@ -327,8 +324,8 @@ class Stream:
             #     status_id = int(delimited_string)
             #     next_status_obj = resp.raw.read(status_id)
             #     if self.running:
-            #         self._data(next_status_obj.decode('utf-8'))
-
+            #         if self.listener.on_data(next_status_obj.decode('utf-8')) is False:
+            #             self.running = False
 
         if resp.raw.closed:
             self.on_closed(resp)