From 6c3bc5585c86ff73e44c53ccbbd8ff20b7e0c48b Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Sat, 13 Jan 2018 19:56:29 +0000 Subject: [PATCH] utils/gh: round off reset and include limit --- papr/utils/gh.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/papr/utils/gh.py b/papr/utils/gh.py index d7d5bbf..e9fce6c 100755 --- a/papr/utils/gh.py +++ b/papr/utils/gh.py @@ -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)