diff --git a/pyhon/connection/auth.py b/pyhon/connection/auth.py index c4d7bbc..4ecc5ab 100644 --- a/pyhon/connection/auth.py +++ b/pyhon/connection/auth.py @@ -134,9 +134,7 @@ class HonAuth: fw_uid, loaded_str = context[0] self._login_data.fw_uid = fw_uid self._login_data.loaded = json.loads(loaded_str) - self._login_data.url = login_url.replace( - "/".join(const.AUTH_API.split("/")[:-1]), "" - ) + self._login_data.url = login_url.replace(const.AUTH_API, "") return True await self._error_logger(response) return False @@ -149,8 +147,8 @@ class HonAuth: "descriptor": "apex://LightningLoginCustomController/ACTION$login", "callingDescriptor": "markup://c:loginForm", "params": { - "username": quote(self._login_data.email), - "password": quote(self._login_data.password), + "username": self._login_data.email, + "password": self._login_data.password, "startUrl": start_url, }, } @@ -172,7 +170,7 @@ class HonAuth: async with self._request.post( const.AUTH_API + "/s/sfsites/aura", headers={"Content-Type": "application/x-www-form-urlencoded"}, - data="&".join(f"{k}={json.dumps(v)}" for k, v in data.items()), + data="&".join(f"{k}={quote(json.dumps(v))}" for k, v in data.items()), params=params, ) as response: if response.status == 200: @@ -210,7 +208,7 @@ class HonAuth: url_search = re.findall( "href\\s*=\\s*[\"'](.*?)[\"']", await response.text() ) - url = "/".join(const.AUTH_API.split("/")[:-1]) + url_search[0] + url = const.AUTH_API + url_search[0] async with self._request.get(url) as response: if response.status != 200: await self._error_logger(response) diff --git a/pyhon/const.py b/pyhon/const.py index c7e2c81..73332df 100644 --- a/pyhon/const.py +++ b/pyhon/const.py @@ -1,4 +1,4 @@ -AUTH_API = "https://he-accounts.force.com/SmartHome" +AUTH_API = "https://account2.hon-smarthome.com" API_URL = "https://api-iot.he.services" API_KEY = "GRCqFhC6Gk@ikWXm1RmnSmX1cm,MxY-configuration" APP = "hon" diff --git a/setup.py b/setup.py index c7988df..7d2a56d 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as f: setup( name="pyhOn", - version="0.12.0", + version="0.12.1", author="Andre Basche", description="Control hOn devices with python", long_description=long_description,