From 7756fa84bc97d0dc3c6c54ed75bc27c9297083ad Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 24 Jan 2021 07:57:04 -0600 Subject: [PATCH] Disregard return value from Stream.on_data --- tweepy/streaming.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index bbc65ab..405ebf2 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -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) -- 2.25.1