Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix asyncio timeout error when getting rate limit, status code 420 #1621

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion tweepy/asynchronous/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# See LICENSE for details.

import asyncio
from asyncio import TimeoutError

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import won't be required as you have referenced TimeoutError as asyncio.TimeoutError.

import json
import logging
from math import inf
Expand Down Expand Up @@ -128,7 +129,8 @@ async def _connect(self, method, endpoint, params={}, headers=None,
if http_error_wait > http_error_wait_max:
http_error_wait = http_error_wait_max
except (aiohttp.ClientConnectionError,
aiohttp.ClientPayloadError) as e:
aiohttp.ClientPayloadError,
asyncio.TimeoutError) as e:
await self.on_connection_error()

await asyncio.sleep(network_error_wait)
Expand Down