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
This commit is contained in:
David Todd (c0de) 2018-01-30 15:45:54 -06:00
parent b75cf268e8
commit eaca92b313

View File

@ -68,21 +68,6 @@ while True:
# Reauth and get the next now playing # Reauth and get the next now playing
sp = authorize_api(username) sp = authorize_api(username)
continue 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: else:
raise Exception(e) raise Exception(e)