From: Harmon Date: Sat, 29 Oct 2022 01:39:11 +0000 (-0500) Subject: Add 1 second buffer to API v2 streaming timeout X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=51a5d61bfd6699ab844449698b34befd6a170857;p=tweepy.git Add 1 second buffer to API v2 streaming timeout The keep-alive is often received after marginally longer than 20 seconds, causing unnecessary timeouts and reconnects with a timeout of exactly 20 seconds --- diff --git a/tweepy/asynchronous/streaming.py b/tweepy/asynchronous/streaming.py index 58eba22..0a943f2 100644 --- a/tweepy/asynchronous/streaming.py +++ b/tweepy/asynchronous/streaming.py @@ -39,7 +39,7 @@ class AsyncBaseStream: async def _connect( self, method, url, params=None, headers=None, body=None, - oauth_client=None, timeout=20 + oauth_client=None, timeout=21 ): error_count = 0 # https://developer.twitter.com/en/docs/twitter-api/v1/tweets/filter-realtime/guides/connecting diff --git a/tweepy/streaming.py b/tweepy/streaming.py index 145f71d..7e77e17 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -52,7 +52,7 @@ class BaseStream: def _connect( self, method, url, auth=None, params=None, headers=None, body=None, - timeout=20 + timeout=21 ): self.running = True