Add HTTP 429 error handling
This commit is contained in:
parent
7b195c4b6a
commit
b9fb40a9f5
@ -23,7 +23,7 @@ def failCheck(response, functOrigin):
|
|||||||
print("Status Code is: "+str(response.status_code))
|
print("Status Code is: "+str(response.status_code))
|
||||||
if response.status_code == 429:
|
if response.status_code == 429:
|
||||||
print("Too many requests!")
|
print("Too many requests!")
|
||||||
time.sleep(int(response.headers["Retry-After"]))
|
time.sleep(15) # Wait 15 seconds
|
||||||
print("Retrying "+functOrigin+"...")
|
print("Retrying "+functOrigin+"...")
|
||||||
return True
|
return True
|
||||||
elif response.status_code != 200:
|
elif response.status_code != 200:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user