Handling rate limiting errors from search api #50
No reviewers
Labels
No labels
Bug
Enhancement
Feature Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: code/twython#50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
I made this change to allow the twython user to handle rate limit errors returned from the twitter search api. The rate limit error is indicated by a response status of 420 and includes the number of seconds the user should wait before retrying. Before the change, the code will execute without error and return "{'error': 'You have been rate limited. Enhance your calm.'}", but does not allow the user to access the retry wait seconds from the response object. After the change the code throws a new exception RateLimitError which extends TwythonError and includes the retry_wait_seconds so the user can wait and retry accordingly.
Thanks for considering my change!
-Kelly
Thanks! Will push out a pypi release with this when I'm not traveling (Tokyo -> SF right now...).