Skip to content

Commit

Permalink
fix: use app-id across different commands
Browse files Browse the repository at this point in the history
  • Loading branch information
fuatakgun committed Feb 7, 2022
1 parent 87c6d1c commit 33ba3a8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions custom_components/kia_uvo/KiaUvoApiEU.py
Expand Up @@ -16,7 +16,7 @@
_LOGGER = logging.getLogger(__name__)

INVALID_STAMP_RETRY_COUNT = 10
USER_AGENT_OK_HTTP: str = "okhttp/3.12.0"
USER_AGENT_OK_HTTP: str = "okhttp/3.10.0"
USER_AGENT_MOZILLA: str = "Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"
ACCEPT_HEADER_ALL: str = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"

Expand Down Expand Up @@ -154,7 +154,7 @@ def get_device_id(self):
"uuid": str(uuid.uuid4()),
}

for i in [0, INVALID_STAMP_RETRY_COUNT]:
for i in range(0, INVALID_STAMP_RETRY_COUNT):
stamp = random.choice(self.stamps)
headers = {
"ccsp-service-id": self.CCSP_SERVICE_ID,
Expand Down Expand Up @@ -330,6 +330,7 @@ def get_authorization_code_with_form(self):
headers = {
"User-Agent": USER_AGENT_MOZILLA,
"ccsp-service-id": self.CCSP_SERVICE_ID,
"ccsp-application-id": self.APP_ID,
}
response = requests.post(
url, headers=headers, json={"intUserId": intUserId}, cookies=self.cookies
Expand Down Expand Up @@ -451,6 +452,8 @@ def update_vehicle_status(self, token: Token):
headers = {
"Authorization": token.refresh_token,
"Stamp": token.stamp,
"ccsp-service-id": self.CCSP_SERVICE_ID,
"ccsp-application-id": self.APP_ID,
"ccsp-device-id": token.device_id,
"Host": self.BASE_URL,
"Connection": "Keep-Alive",
Expand All @@ -467,6 +470,8 @@ def lock_action(self, token: Token, action):
headers = {
"Authorization": token.access_token,
"Stamp": token.stamp,
"ccsp-service-id": self.CCSP_SERVICE_ID,
"ccsp-application-id": self.APP_ID,
"ccsp-device-id": token.device_id,
"Host": self.BASE_URL,
"Connection": "Keep-Alive",
Expand All @@ -486,6 +491,8 @@ def start_climate(
headers = {
"Authorization": token.access_token,
"Stamp": token.stamp,
"ccsp-service-id": self.CCSP_SERVICE_ID,
"ccsp-application-id": self.APP_ID,
"ccsp-device-id": token.device_id,
"Host": self.BASE_URL,
"Connection": "Keep-Alive",
Expand Down Expand Up @@ -517,6 +524,8 @@ def stop_climate(self, token: Token):
headers = {
"Authorization": token.access_token,
"Stamp": token.stamp,
"ccsp-service-id": self.CCSP_SERVICE_ID,
"ccsp-application-id": self.APP_ID,
"ccsp-device-id": token.device_id,
"Host": self.BASE_URL,
"Connection": "Keep-Alive",
Expand All @@ -543,6 +552,8 @@ def start_charge(self, token: Token):
headers = {
"Authorization": token.access_token,
"Stamp": token.stamp,
"ccsp-service-id": self.CCSP_SERVICE_ID,
"ccsp-application-id": self.APP_ID,
"ccsp-device-id": token.device_id,
"Host": self.BASE_URL,
"Connection": "Keep-Alive",
Expand All @@ -560,6 +571,8 @@ def stop_charge(self, token: Token):
headers = {
"Authorization": token.access_token,
"Stamp": token.stamp,
"ccsp-service-id": self.CCSP_SERVICE_ID,
"ccsp-application-id": self.APP_ID,
"ccsp-device-id": token.device_id,
"Host": self.BASE_URL,
"Connection": "Keep-Alive",
Expand Down

0 comments on commit 33ba3a8

Please sign in to comment.