Added retry for error codes 421 and 500

This commit is contained in:
Niccolò Zapponi 2020-11-10 19:42:46 +00:00
parent 6f0aa0360a
commit 8e55d638f1
No known key found for this signature in database
GPG key ID: 328B304DC670A51E

View file

@ -102,7 +102,7 @@ class PyiCloudSession(Session):
LOGGER.debug("Cookies saved to %s", self.service.cookiejar_path)
if not response.ok and content_type not in json_mimetypes:
if has_retried is None and response.status_code == 450:
if has_retried is None and response.status_code in [421, 450, 500]:
api_error = PyiCloudAPIResponseException(
response.reason, response.status_code, retry=True
)