diff --git a/libpurecoollink/dyson.py b/libpurecoollink/dyson.py index 88e1543..fe7fe77 100644 --- a/libpurecoollink/dyson.py +++ b/libpurecoollink/dyson.py @@ -32,6 +32,9 @@ def __init__(self, email, password, country): self._country = country self._logged = False self._auth = None + self._api = DYSON_API_URL + if self._country == 'CN': + self._api = "api.cp.dyson.cn" def login(self): """Login to dyson web services.""" @@ -41,7 +44,7 @@ def login(self): } login = requests.post( "https://{0}/v1/userregistration/authenticate?country={1}".format( - DYSON_API_URL, self._country), request_body, verify=False) + self._api, self._country), request_body, verify=False) # pylint: disable=no-member if login.status_code == requests.codes.ok: json_response = login.json() @@ -57,7 +60,7 @@ def devices(self): if self._logged: device_response = requests.get( "https://{0}/v1/provisioningservice/manifest".format( - DYSON_API_URL), verify=False, auth=self._auth) + self._api), verify=False, auth=self._auth) devices = [] for device in device_response.json(): if is_360_eye_device(device):