From: Harmon Date: Mon, 4 Jan 2021 09:35:38 +0000 (-0600) Subject: Remove Stream._data method X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=423a3f47eddb0cd46068fbd15c3cd27c0313f8d3;p=tweepy.git Remove Stream._data method --- diff --git a/tweepy/streaming.py b/tweepy/streaming.py index 36f18a4..0907c88 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -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\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)