Skip to content

Commit

Permalink
Remove Stream.timeout
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Harmon758 committed Jan 23, 2021
1 parent c9f59e6 commit a2f79f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tweepy/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def __init__(self, consumer_key, consumer_secret, access_token,
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
Expand Down Expand Up @@ -160,6 +159,7 @@ def _run(self, endpoint, params=None, body=None):

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
Expand All @@ -174,7 +174,7 @@ def _run(self, endpoint, params=None, body=None):
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:
Expand Down

0 comments on commit a2f79f1

Please sign in to comment.