Skip to content

Commit

Permalink
Allow alternate rate limit notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
nawatts committed Nov 8, 2016
1 parent 5fa066b commit c713b4f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tweepy/binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def execute(self):
sleep_time = self._reset_time - int(time.time())
if sleep_time > 0:
if self.wait_on_rate_limit_notify:
log.warning("Rate limit reached. Sleeping for: %d" % sleep_time)
if callable(self.wait_on_rate_limit_notify):
self.wait_on_rate_limit_notify(sleep_time)
else:
log.warning("Rate limit reached. Sleeping for: %d" % sleep_time)
time.sleep(sleep_time + 5) # sleep for few extra sec

# if self.wait_on_rate_limit and self._reset_time is not None and \
Expand Down

0 comments on commit c713b4f

Please sign in to comment.