Fix for 450 reauthentication failure bug (#372)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
42331c3e37
commit
cc631cdce7
1 changed files with 5 additions and 2 deletions
|
@ -105,13 +105,16 @@ class PyiCloudSession(Session):
|
||||||
fmip_url = self.service._get_webservice_url("findme")
|
fmip_url = self.service._get_webservice_url("findme")
|
||||||
if (
|
if (
|
||||||
has_retried is None
|
has_retried is None
|
||||||
and response.status_code == 450
|
and response.status_code in [421, 450, 500]
|
||||||
and fmip_url in url
|
and fmip_url in url
|
||||||
):
|
):
|
||||||
# Handle re-authentication for Find My iPhone
|
# Handle re-authentication for Find My iPhone
|
||||||
LOGGER.debug("Re-authenticating Find My iPhone service")
|
LOGGER.debug("Re-authenticating Find My iPhone service")
|
||||||
try:
|
try:
|
||||||
self.service.authenticate(True, "find")
|
# If 450, authentication requires a full sign in to the account
|
||||||
|
service = None if response.status_code == 450 else "find"
|
||||||
|
self.service.authenticate(True, service)
|
||||||
|
|
||||||
except PyiCloudAPIResponseException:
|
except PyiCloudAPIResponseException:
|
||||||
LOGGER.debug("Re-authentication failed")
|
LOGGER.debug("Re-authentication failed")
|
||||||
kwargs["retried"] = True
|
kwargs["retried"] = True
|
||||||
|
|
Loading…
Reference in a new issue