From a2f79f1b6e4406672895764b044d18b33dc527fd Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 10:48:37 -0600 Subject: [PATCH] Remove Stream.timeout Use 90 seconds as the read timeout, per https://developer.twitter.com/en/docs/twitter-api/v1/tweets/filter-realtime/guides/connecting. Default to using the same 90 seconds for connect timeout. --- tweepy/streaming.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index 8738ae6..c4099ce 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -130,7 +130,6 @@ class Stream: self.listener = listener self.running = False self.daemon = options.get("daemon", False) - self.timeout = options.get("timeout", 300.0) self.retry_count = options.get("retry_count") # The default socket.read size. Default to less than half the size of @@ -160,6 +159,7 @@ class Stream: error_count = 0 # https://developer.twitter.com/en/docs/twitter-api/v1/tweets/filter-realtime/guides/connecting + stall_timeout = 90 network_error_wait = network_error_wait_step = 0.25 network_error_wait_max = 16 http_error_wait = http_error_wait_start = 5 @@ -174,7 +174,7 @@ class Stream: try: with self.session.request( 'POST', url, params=params, data=body, - timeout=self.timeout, stream=True, auth=auth, + timeout=stall_timeout, stream=True, auth=auth, verify=self.verify, proxies=self.proxies ) as resp: if resp.status_code != 200: -- 2.25.1