Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Commit

Permalink
utils/gh: round off reset and include limit
Browse files Browse the repository at this point in the history
  • Loading branch information
jlebon committed Jan 13, 2018
1 parent cfc6e18 commit 6c3bc55
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions papr/utils/gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ def _print_ratelimit_info(resp):
try:
utc_now = int(datetime.datetime.utcnow().strftime("%s"))
utc_reset = int(resp.headers['X-RateLimit-Reset'])
print("X-RateLimit-Remaining: %s (resets in %s mins)" %
(resp.headers['X-RateLimit-Remaining'], (utc_reset-utc_now)/60))
next_reset = int((utc_reset - utc_now) / 60)
print("X-RateLimit-Remaining: %s/%s (resets in %s mins)" %
(resp.headers['X-RateLimit-Remaining'],
resp.headers['X-RateLimit-Limit'], next_reset))
except Exception as e:
print("Can't print rate limit info: %s" % e)

Expand Down

0 comments on commit 6c3bc55

Please sign in to comment.