Add HTTP 429 error handling

This commit is contained in:
Chloe Fontenot 🏳️‍⚧️ 2022-02-24 13:32:59 -06:00
parent 7b195c4b6a
commit b9fb40a9f5

View File

@ -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: