Skip to content

Commit

Permalink
Fixed another long code line
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew A. Russell committed Jan 28, 2011
1 parent 3597294 commit 87cbacd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions recipe__make_twitter_request.py
Expand Up @@ -24,8 +24,8 @@ def handle_http_error(e, t, wait_period=2):
print >> sys.stderr, 'Encountered 401 Error (Not Authorized)'
return None
elif e.e.code in (502, 503):
print >> sys.stderr, 'Encountered %i Error. Will retry in %i seconds' % (e.e.code,
wait_period)
print >> sys.stderr, 'Encountered %i Error. Will retry in %i seconds' % \
(e.e.code, wait_period)
time.sleep(wait_period)
wait_period *= 1.5
return wait_period
Expand All @@ -34,7 +34,8 @@ def handle_http_error(e, t, wait_period=2):
now = time.time() # UTC
when_rate_limit_resets = status['reset_time_in_seconds'] # UTC
sleep_time = when_rate_limit_resets - now
print >> sys.stderr, 'Rate limit reached: sleeping for %i secs' % (sleep_time, )
print >> sys.stderr, 'Rate limit reached: sleeping for %i secs' % \
(sleep_time, )
time.sleep(sleep_time)
return 2
else:
Expand Down

0 comments on commit 87cbacd

Please sign in to comment.