mirror of
https://github.com/c0de-archive/spotipy.git
synced 2024-11-04 23:17:48 +00:00
debugging retry logic
This commit is contained in:
parent
a7936b8351
commit
cf75879a15
@ -123,15 +123,15 @@ class Spotify(object):
|
||||
retries -= 1
|
||||
status = e.http_status
|
||||
# 429 means we hit a rate limit, backoff
|
||||
if status == 429 or status >= 500 and status < 600:
|
||||
if status == 429 or (status >= 500 and status < 600):
|
||||
if retries < 0:
|
||||
raise
|
||||
else:
|
||||
if self.trace:
|
||||
print ('retrying ...' + str(delay) + 'secs')
|
||||
print ('retrying ...' + str(delay) + 'secs')
|
||||
time.sleep(delay)
|
||||
delay += 1
|
||||
else:
|
||||
print ('http status:' + status)
|
||||
raise
|
||||
|
||||
def _post(self, url, args=None, payload=None, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user