Fixed bug
This commit is contained in:
parent
e0f11158e1
commit
94f8ef8aaa
1 changed files with 14 additions and 10 deletions
|
@ -104,17 +104,21 @@ class PyiCloudSession(Session):
|
||||||
|
|
||||||
if not response.ok and (content_type not in json_mimetypes
|
if not response.ok and (content_type not in json_mimetypes
|
||||||
or response.status_code in [421, 450, 500]):
|
or response.status_code in [421, 450, 500]):
|
||||||
if has_retried is None and response.status_code == 450 and self.service._get_webservice_url("findme") in url:
|
try:
|
||||||
# Handle re-authentication for Find My iPhone
|
fmip_url = self.service._get_webservice_url("findme")
|
||||||
LOGGER.debug("Re-authenticating Find My iPhone service")
|
if has_retried is None and response.status_code == 450 and fmip_url in url:
|
||||||
try:
|
# Handle re-authentication for Find My iPhone
|
||||||
self.service.authenticate(True, "find")
|
LOGGER.debug("Re-authenticating Find My iPhone service")
|
||||||
except PyiCloudAPIResponseException:
|
try:
|
||||||
LOGGER.debug("Re-authentication failed")
|
self.service.authenticate(True, "find")
|
||||||
kwargs["retried"] = True
|
except PyiCloudAPIResponseException:
|
||||||
return self.request(method, url, **kwargs)
|
LOGGER.debug("Re-authentication failed")
|
||||||
|
kwargs["retried"] = True
|
||||||
|
return self.request(method, url, **kwargs)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
elif has_retried is None and response.status_code in [421, 450, 500]:
|
if has_retried is None and response.status_code in [421, 450, 500]:
|
||||||
api_error = PyiCloudAPIResponseException(
|
api_error = PyiCloudAPIResponseException(
|
||||||
response.reason, response.status_code, retry=True
|
response.reason, response.status_code, retry=True
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue