Skip to content

Commit f827cbc

Browse files
authored
fix: require both country code and country (#533)
1 parent 8539fe4 commit f827cbc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

roborock/web_api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,15 @@ async def _get_iot_login_info(self) -> IotLoginInfo:
9696
)
9797
else:
9898
raise RoborockException(f"{response.get('msg')} - response code: {response_code}")
99-
if response["data"]["countrycode"] is not None:
99+
country_code = response["data"]["countrycode"]
100+
country = response["data"]["country"]
101+
if country_code is not None and country is not None:
100102
self._iot_login_info = IotLoginInfo(
101103
base_url=response["data"]["url"],
102-
country=response["data"]["country"],
103-
country_code=response["data"]["countrycode"],
104+
country=country,
105+
country_code=country_code,
104106
)
107+
_LOGGER.debug("Country determined to be %s and code is %s", country, country_code)
105108
return self._iot_login_info
106109
raise RoborockNoResponseFromBaseURL(
107110
"No account was found for any base url we tried. Either your email is incorrect or we do not have a"

0 commit comments

Comments
 (0)