From 1e5a90486c3a8a8fd64e1615e03b1f065355522f Mon Sep 17 00:00:00 2001 From: Jonas Michel Date: Wed, 20 Jan 2016 14:48:02 -0600 Subject: [PATCH] Fixes #29 Reporting an error when the user's rate limit is exceeded causes the script to terminate after resuming execution from a rate limit sleep. Instead of generating an explicit error we just want to inform the user that the script is going to sleep until their rate limit count resets. --- bin/github-backup | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/github-backup b/bin/github-backup index a7d86d3..054fe92 100755 --- a/bin/github-backup +++ b/bin/github-backup @@ -299,10 +299,10 @@ def get_query_args(query_args=None): def _get_response(request, auth, template): retry_timeout = 3 + errors = [] # We'll make requests in a loop so we can # delay and retry in the case of rate-limiting while True: - errors = [] should_continue = False try: r = urllib2.urlopen(request) @@ -356,10 +356,9 @@ def _request_http_error(exc, auth, errors): print('Exceeded rate limit of {} requests; waiting {} seconds to reset'.format(limit, delta), # noqa file=sys.stderr) - ratelimit_error = 'No more requests remaining' if auth is None: - ratelimit_error += '; authenticate to raise your GitHub rate limit' # noqa - errors.append(ratelimit_error) + print('Hint: Authenticate to raise your GitHub rate limit', + file=sys.stderr) time.sleep(delta) should_continue = True