hyundai-kia-connect-api 3.17.0__py2.py3-none-any.whl → 3.17.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hyundai_kia_connect_api/KiaUvoAPIUSA.py +20 -5
- hyundai_kia_connect_api/KiaUvoApiAU.py +9 -3
- {hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/METADATA +1 -1
- {hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/RECORD +8 -8
- {hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/AUTHORS.rst +0 -0
- {hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/LICENSE +0 -0
- {hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/WHEEL +0 -0
- {hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/top_level.txt +0 -0
@@ -6,6 +6,7 @@ import logging
|
|
6
6
|
import random
|
7
7
|
import re
|
8
8
|
import secrets
|
9
|
+
import ssl
|
9
10
|
import string
|
10
11
|
import time
|
11
12
|
import typing
|
@@ -14,6 +15,8 @@ from datetime import datetime
|
|
14
15
|
import pytz
|
15
16
|
import requests
|
16
17
|
from requests import RequestException, Response
|
18
|
+
from requests.adapters import HTTPAdapter
|
19
|
+
from urllib3.util.ssl_ import create_urllib3_context
|
17
20
|
|
18
21
|
from .ApiImpl import ApiImpl, ClimateRequestOptions
|
19
22
|
from .Token import Token
|
@@ -31,6 +34,16 @@ from .utils import get_child_value
|
|
31
34
|
_LOGGER = logging.getLogger(__name__)
|
32
35
|
|
33
36
|
|
37
|
+
# This is the key part of our patch. We get the standard SSLContext that requests would
|
38
|
+
# normally use, and add ciphers that Kia USA may need for compatibility.
|
39
|
+
class KiaSSLAdapter(HTTPAdapter):
|
40
|
+
def init_poolmanager(self, *args, **kwargs):
|
41
|
+
context = create_urllib3_context(
|
42
|
+
ciphers='DEFAULT:@SECLEVEL=1', ssl_version=ssl.PROTOCOL_TLSv1_2)
|
43
|
+
kwargs['ssl_context'] = context
|
44
|
+
return super().init_poolmanager(*args, **kwargs)
|
45
|
+
|
46
|
+
|
34
47
|
class AuthError(RequestException):
|
35
48
|
"""AuthError"""
|
36
49
|
|
@@ -108,6 +121,8 @@ class KiaUvoAPIUSA(ApiImpl):
|
|
108
121
|
|
109
122
|
self.BASE_URL: str = "api.owners.kia.com"
|
110
123
|
self.API_URL: str = "https://" + self.BASE_URL + "/apigw/v1/"
|
124
|
+
self.session = requests.Session()
|
125
|
+
self.session.mount("https://", KiaSSLAdapter())
|
111
126
|
|
112
127
|
def api_headers(self) -> dict:
|
113
128
|
offset = time.localtime().tm_gmtoff / 60 / 60
|
@@ -149,7 +164,7 @@ class KiaUvoAPIUSA(ApiImpl):
|
|
149
164
|
self, token: Token, url: str, json_body: dict, vehicle: Vehicle
|
150
165
|
) -> Response:
|
151
166
|
headers = self.authed_api_headers(token, vehicle)
|
152
|
-
return
|
167
|
+
return self.session.post(url, json=json_body, headers=headers)
|
153
168
|
|
154
169
|
@request_with_active_session
|
155
170
|
@request_with_logging
|
@@ -157,7 +172,7 @@ class KiaUvoAPIUSA(ApiImpl):
|
|
157
172
|
self, token: Token, url: str, vehicle: Vehicle
|
158
173
|
) -> Response:
|
159
174
|
headers = self.authed_api_headers(token, vehicle)
|
160
|
-
return
|
175
|
+
return self.session.get(url, headers=headers)
|
161
176
|
|
162
177
|
def login(self, username: str, password: str) -> Token:
|
163
178
|
"""Login into cloud endpoints and return Token"""
|
@@ -170,7 +185,7 @@ class KiaUvoAPIUSA(ApiImpl):
|
|
170
185
|
"userCredential": {"userId": username, "password": password},
|
171
186
|
}
|
172
187
|
headers = self.api_headers()
|
173
|
-
response =
|
188
|
+
response = self.session.post(url, json=data, headers=headers)
|
174
189
|
_LOGGER.debug(f"{DOMAIN} - Sign In Response {response.text}")
|
175
190
|
session_id = response.headers.get("sid")
|
176
191
|
if not session_id:
|
@@ -191,7 +206,7 @@ class KiaUvoAPIUSA(ApiImpl):
|
|
191
206
|
url = self.API_URL + "ownr/gvl"
|
192
207
|
headers = self.api_headers()
|
193
208
|
headers["sid"] = token.access_token
|
194
|
-
response =
|
209
|
+
response = self.session.get(url, headers=headers)
|
195
210
|
_LOGGER.debug(f"{DOMAIN} - Get Vehicles Response {response.text}")
|
196
211
|
response = response.json()
|
197
212
|
result = []
|
@@ -216,7 +231,7 @@ class KiaUvoAPIUSA(ApiImpl):
|
|
216
231
|
url = self.API_URL + "ownr/gvl"
|
217
232
|
headers = self.api_headers()
|
218
233
|
headers["sid"] = token.access_token
|
219
|
-
response =
|
234
|
+
response = self.session.get(url, headers=headers)
|
220
235
|
_LOGGER.debug(f"{DOMAIN} - Get Vehicles Response {response.text}")
|
221
236
|
_LOGGER.debug(f"{DOMAIN} - Vehicles Type Passed in: {type(vehicles)}")
|
222
237
|
_LOGGER.debug(f"{DOMAIN} - Vehicles Passed in: {vehicles}")
|
@@ -53,7 +53,9 @@ from .utils import (
|
|
53
53
|
_LOGGER = logging.getLogger(__name__)
|
54
54
|
|
55
55
|
USER_AGENT_OK_HTTP: str = "okhttp/3.12.0"
|
56
|
-
USER_AGENT_MOZILLA: str =
|
56
|
+
USER_AGENT_MOZILLA: str = (
|
57
|
+
"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" # noqa
|
58
|
+
)
|
57
59
|
|
58
60
|
|
59
61
|
def _check_response_for_errors(response: dict) -> None:
|
@@ -104,12 +106,16 @@ class KiaUvoApiAU(ApiImpl):
|
|
104
106
|
self.BASE_URL: str = "au-apigw.ccs.kia.com.au:8082"
|
105
107
|
self.CCSP_SERVICE_ID: str = "8acb778a-b918-4a8d-8624-73a0beb64289"
|
106
108
|
self.APP_ID: str = "4ad4dcde-be23-48a8-bc1c-91b94f5c06f8" # Android app ID
|
107
|
-
self.BASIC_AUTHORIZATION: str =
|
109
|
+
self.BASIC_AUTHORIZATION: str = (
|
110
|
+
"Basic OGFjYjc3OGEtYjkxOC00YThkLTg2MjQtNzNhMGJlYjY0Mjg5OjdTY01NbTZmRVlYZGlFUEN4YVBhUW1nZVlkbFVyZndvaDRBZlhHT3pZSVMyQ3U5VA=="
|
111
|
+
)
|
108
112
|
elif BRANDS[brand] == BRAND_HYUNDAI:
|
109
113
|
self.BASE_URL: str = "au-apigw.ccs.hyundai.com.au:8080"
|
110
114
|
self.CCSP_SERVICE_ID: str = "855c72df-dfd7-4230-ab03-67cbf902bb1c"
|
111
115
|
self.APP_ID: str = "f9ccfdac-a48d-4c57-bd32-9116963c24ed" # Android app ID
|
112
|
-
self.BASIC_AUTHORIZATION: str =
|
116
|
+
self.BASIC_AUTHORIZATION: str = (
|
117
|
+
"Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw=="
|
118
|
+
)
|
113
119
|
|
114
120
|
self.USER_API_URL: str = "https://" + self.BASE_URL + "/api/v1/user/"
|
115
121
|
self.SPA_API_URL: str = "https://" + self.BASE_URL + "/api/v1/spa/"
|
{hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: hyundai_kia_connect_api
|
3
|
-
Version: 3.17.
|
3
|
+
Version: 3.17.1
|
4
4
|
Summary: Python Boilerplate contains all the boilerplate you need to create a Python package.
|
5
5
|
Home-page: https://github.com/fuatakgun/hyundai_kia_connect_api
|
6
6
|
Author: Fuat Akgun
|
{hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/RECORD
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
hyundai_kia_connect_api/ApiImpl.py,sha256=1j5FRTQIILrSzQU6oE5i4J_l8cVvYuMGBmQn-kL7zyg,5018
|
2
2
|
hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py,sha256=FVWDzmkO_jsc_r4WzufgxaJkeVYhf9UAw9A6r37b-Dc,26750
|
3
|
-
hyundai_kia_connect_api/KiaUvoAPIUSA.py,sha256=
|
4
|
-
hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=
|
3
|
+
hyundai_kia_connect_api/KiaUvoAPIUSA.py,sha256=Y4UZtms8Rk-od1ZlGQ2ZhR2DcPPhoNOhL3mQ1Ydrp_0,31208
|
4
|
+
hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=voZYw2QxWLwzbTc1hwATcgaT_0aZZl29xVFGmiYHPdg,48800
|
5
5
|
hyundai_kia_connect_api/KiaUvoApiCA.py,sha256=7bcDLcJ3JLLoWldPy514eKhWUAo1Gb1mu_3SaXno4v8,30358
|
6
6
|
hyundai_kia_connect_api/KiaUvoApiCN.py,sha256=MjXdDdm1wDVvFZhgg8AjAF6X2SB-AIFMTE5iRmr80QM,47384
|
7
7
|
hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=GqJhJWJ8vD07OG6dIOj5nammzr7822TNcW031A6AQUw,68001
|
@@ -12,9 +12,9 @@ hyundai_kia_connect_api/__init__.py,sha256=6UwXW6Lj5VnRtWNOt_0dLFdOYlcbysHCc6ol_
|
|
12
12
|
hyundai_kia_connect_api/const.py,sha256=C25jgV79u7SZF5xDy96gol_CekIkyI4h3goTyDEmng0,1967
|
13
13
|
hyundai_kia_connect_api/exceptions.py,sha256=m7gyDnvA5OVAK4EXSP_ZwE0s0uV8HsGUV0tiYwqofK0,1343
|
14
14
|
hyundai_kia_connect_api/utils.py,sha256=rfhERPXkzqelsaieLtiAyN9xDDTheNyKX5aBPRLrHf4,1117
|
15
|
-
hyundai_kia_connect_api-3.17.
|
16
|
-
hyundai_kia_connect_api-3.17.
|
17
|
-
hyundai_kia_connect_api-3.17.
|
18
|
-
hyundai_kia_connect_api-3.17.
|
19
|
-
hyundai_kia_connect_api-3.17.
|
20
|
-
hyundai_kia_connect_api-3.17.
|
15
|
+
hyundai_kia_connect_api-3.17.1.dist-info/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
|
16
|
+
hyundai_kia_connect_api-3.17.1.dist-info/LICENSE,sha256=AsZwIRViAze7ObwO6V6IB0q4caXv6DJS2-3dsU1FWy8,1069
|
17
|
+
hyundai_kia_connect_api-3.17.1.dist-info/METADATA,sha256=VGRxcAXvKu1Btq-lzyzLoBslMcoyWEPicDemYHlOYX8,5770
|
18
|
+
hyundai_kia_connect_api-3.17.1.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
|
19
|
+
hyundai_kia_connect_api-3.17.1.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
|
20
|
+
hyundai_kia_connect_api-3.17.1.dist-info/RECORD,,
|
{hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/AUTHORS.rst
RENAMED
File without changes
|
{hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/LICENSE
RENAMED
File without changes
|
File without changes
|
{hyundai_kia_connect_api-3.17.0.dist-info → hyundai_kia_connect_api-3.17.1.dist-info}/top_level.txt
RENAMED
File without changes
|