Handling rate limiting errors from search api #50

Merged
mckellister merged 2 commits from master into master 2011-11-10 14:10:17 -08:00
mckellister commented 2011-11-09 15:57:35 -08:00 (Migrated from github.com)

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

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
ryanmcgrath commented 2011-11-10 14:10:52 -08:00 (Migrated from github.com)

Thanks! Will push out a pypi release with this when I'm not traveling (Tokyo -> SF right now...).

Thanks! Will push out a pypi release with this when I'm not traveling (Tokyo -> SF right now...).
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#50
No description provided.