mirror of
https://github.com/c0de-archive/spotipy-experiments.git
synced 2024-11-16 05:27:26 +00:00
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:
parent
b75cf268e8
commit
eaca92b313
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user