-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Added monitoring of api rate limits and waiting for replenishment. #390
Conversation
@joshthecoder: Does this look good to you? |
Not sure I like sleeping until the rate limit is removed. Almost would prefer just an exception |
Waiting is conditional on an optional parameter, which is set by default to On Feb 26, 2014 11:35 AM, "Joshua Roesslein" [email protected]
|
@@ -155,15 +167,31 @@ def execute(self): | |||
resp = conn.getresponse() | |||
except Exception, e: | |||
raise TweepError('Failed to send request: %s' % e) | |||
|
|||
|
|||
if self.wait_on_rate_limit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nirg: Shouldn't we always store the remaining calls and time until reset? Even if Tweepy doesn't sleep, it might be useful to be able to get the number of calls remaining?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I don't mind doing it either way, but I think the more likely use
cases to reach the rate limits are ones that use cursors and in these cases
it makes sense to wait or get an exception. If you come up with a use case
that needs to monitor the rate limit and doesn't involve a cursor then I'm
happy to implement it.
On Mar 13, 2014 2:56 PM, "Aaron1011" [email protected] wrote:
In tweepy/binder.py:
@@ -155,15 +167,31 @@ def execute(self):
resp = conn.getresponse()
except Exception, e:raise TweepError('Failed to send request: %s' % e)
if self.wait_on_rate_limit:
@nirg https://github.com/nirg: Shouldn't we always store the remaining
calls and time until reset? Even if Tweepy doesn't sleep, it might be
useful to be able to get the number of calls remaining?—
Reply to this email directly or view it on GitHubhttps://github.com//pull/390/files#r10580177
.
Added monitoring of api rate limits and waiting for replenishment.
Should address issue #254.