Reintentar request si es que el servidor responde con 503
Resulta que musicbrainz puede responde con 503 a pesar de ser buena gente y mantener el ratelimit, esto puede ser por varias razones documentadas en https://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting
This commit is contained in:
@@ -49,8 +49,11 @@ def _do_request_mb(url):
|
|||||||
:return: The dictionary with the response or the status and his an error message
|
:return: The dictionary with the response or the status and his an error message
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ratelimit()
|
while True:
|
||||||
response = _do_request(url)
|
ratelimit()
|
||||||
|
response = _do_request(url)
|
||||||
|
if response.status_code != 503:
|
||||||
|
break
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
response = response.json(object_hook=sanitize_keys)
|
response = response.json(object_hook=sanitize_keys)
|
||||||
|
|||||||
Reference in New Issue
Block a user