From eaca92b3139408e966ad3cf78ec606554df58115 Mon Sep 17 00:00:00 2001 From: "David Todd (c0de)" Date: Tue, 30 Jan 2018 15:45:54 -0600 Subject: [PATCH] Remove Rate Limit stuff This appears to be handled internally to the library instead: https://github.com/plamere/spotipy/blob/master/spotipy/client.py#L153 --- save_now_playing.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/save_now_playing.py b/save_now_playing.py index 8653164..0aaf4bf 100644 --- a/save_now_playing.py +++ b/save_now_playing.py @@ -68,21 +68,6 @@ while True: # Reauth and get the next now playing sp = authorize_api(username) continue - if e.http_status == '429': # Too Many Requests - # We're hitting the API too fast. The response should include a "Retry-After" Header - if e.headers and e.headers["Retry-After"]: - secs = float(e.headers["Retry-After"]) - print "[%.2fs] Too Many API Requests, waiting %.1fs before continuing" % \ - (time.time()-start_time, secs) - # Wait X Seconds before trying again - time.sleep(secs - (time.time() - start_time) % secs) - continue - else: - # Wait 30 secs - print "[%.2fs] Too Many API Requests and No Retry-After Header, \ - waiting 30s before continuing" % (time.time()-start_time) - time.sleep(30.0 - (time.time() - start_time) % 30.0) - continue else: raise Exception(e)