Add HTTP 429 error handling
This commit is contained in:
parent
b9fb40a9f5
commit
c8713742af
@ -22,8 +22,8 @@ base_api_url = "https://api.modrinth.com:443/api/v1"
|
|||||||
def failCheck(response, functOrigin):
|
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!"+'\n'+"Waiting for 30 seconds...")
|
||||||
time.sleep(15) # Wait 15 seconds
|
time.sleep(30) # Wait 30 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