mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-01-19 02:50:44 +00:00
Fix changed hOn login
This commit is contained in:
parent
31c03faca8
commit
3c7ad3f395
|
@ -134,9 +134,7 @@ class HonAuth:
|
||||||
fw_uid, loaded_str = context[0]
|
fw_uid, loaded_str = context[0]
|
||||||
self._login_data.fw_uid = fw_uid
|
self._login_data.fw_uid = fw_uid
|
||||||
self._login_data.loaded = json.loads(loaded_str)
|
self._login_data.loaded = json.loads(loaded_str)
|
||||||
self._login_data.url = login_url.replace(
|
self._login_data.url = login_url.replace(const.AUTH_API, "")
|
||||||
"/".join(const.AUTH_API.split("/")[:-1]), ""
|
|
||||||
)
|
|
||||||
return True
|
return True
|
||||||
await self._error_logger(response)
|
await self._error_logger(response)
|
||||||
return False
|
return False
|
||||||
|
@ -149,8 +147,8 @@ class HonAuth:
|
||||||
"descriptor": "apex://LightningLoginCustomController/ACTION$login",
|
"descriptor": "apex://LightningLoginCustomController/ACTION$login",
|
||||||
"callingDescriptor": "markup://c:loginForm",
|
"callingDescriptor": "markup://c:loginForm",
|
||||||
"params": {
|
"params": {
|
||||||
"username": quote(self._login_data.email),
|
"username": self._login_data.email,
|
||||||
"password": quote(self._login_data.password),
|
"password": self._login_data.password,
|
||||||
"startUrl": start_url,
|
"startUrl": start_url,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -172,7 +170,7 @@ class HonAuth:
|
||||||
async with self._request.post(
|
async with self._request.post(
|
||||||
const.AUTH_API + "/s/sfsites/aura",
|
const.AUTH_API + "/s/sfsites/aura",
|
||||||
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
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,
|
params=params,
|
||||||
) as response:
|
) as response:
|
||||||
if response.status == 200:
|
if response.status == 200:
|
||||||
|
@ -210,7 +208,7 @@ class HonAuth:
|
||||||
url_search = re.findall(
|
url_search = re.findall(
|
||||||
"href\\s*=\\s*[\"'](.*?)[\"']", await response.text()
|
"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:
|
async with self._request.get(url) as response:
|
||||||
if response.status != 200:
|
if response.status != 200:
|
||||||
await self._error_logger(response)
|
await self._error_logger(response)
|
||||||
|
|
|
@ -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_URL = "https://api-iot.he.services"
|
||||||
API_KEY = "GRCqFhC6Gk@ikWXm1RmnSmX1cm,MxY-configuration"
|
API_KEY = "GRCqFhC6Gk@ikWXm1RmnSmX1cm,MxY-configuration"
|
||||||
APP = "hon"
|
APP = "hon"
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ with open("README.md", "r") as f:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="pyhOn",
|
name="pyhOn",
|
||||||
version="0.12.0",
|
version="0.12.1",
|
||||||
author="Andre Basche",
|
author="Andre Basche",
|
||||||
description="Control hOn devices with python",
|
description="Control hOn devices with python",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
|
Loading…
Reference in a new issue