Add HTTP 429 error handling

This commit is contained in:
Chloe Fontenot 🏳️‍⚧️ 2022-02-24 13:56:04 -06:00
parent b9fb40a9f5
commit c8713742af

View File

@ -22,8 +22,8 @@ base_api_url = "https://api.modrinth.com:443/api/v1"
def failCheck(response, functOrigin):
print("Status Code is: "+str(response.status_code))
if response.status_code == 429:
print("Too many requests!")
time.sleep(15) # Wait 15 seconds
print("Too many requests!"+'\n'+"Waiting for 30 seconds...")
time.sleep(30) # Wait 30 seconds
print("Retrying "+functOrigin+"...")
return True
elif response.status_code != 200: