mirror of
https://github.com/c0de-archive/spotipy.git
synced 2024-11-05 07:27:47 +00:00
Improved retry logic
This commit is contained in:
parent
fd9441a1e7
commit
10cf88da90
@ -135,6 +135,17 @@ class Spotify(object):
|
|||||||
else:
|
else:
|
||||||
print ('http status:' + str(status))
|
print ('http status:' + str(status))
|
||||||
raise
|
raise
|
||||||
|
except:
|
||||||
|
# some other exception. Requests have
|
||||||
|
# been know to throw a BadStatusLine exception
|
||||||
|
retries -= 1
|
||||||
|
if retries >= 0:
|
||||||
|
print ('retrying ...' + str(delay) + 'secs')
|
||||||
|
time.sleep(delay)
|
||||||
|
delay += 1
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
def _post(self, url, args=None, payload=None, **kwargs):
|
def _post(self, url, args=None, payload=None, **kwargs):
|
||||||
if args:
|
if args:
|
||||||
|
Loading…
Reference in New Issue
Block a user