Skip to content

Commit

Permalink
Add stamps to kia soc module to fix problem with new API
Browse files Browse the repository at this point in the history
  • Loading branch information
jss-niro committed Mar 13, 2021
1 parent 7fa13e2 commit bd2161f
Show file tree
Hide file tree
Showing 2 changed files with 1,014 additions and 4 deletions.
17 changes: 13 additions & 4 deletions modules/soc_kia/kiasoc.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
import requests
import uuid
import json
import random
import urllib.parse as urlparse
from urllib.parse import parse_qs
import stamps

email = str(sys.argv[1])
password = str(sys.argv[2])
pin = str(sys.argv[3])
vin = str(sys.argv[4])
socfile = str(sys.argv[5])

def get_stamp():
return stamps.stamps[random.randint(0,len(stamps.stamps))]

def main():
#diviceID
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/notifications/register'
Expand All @@ -21,7 +26,8 @@ def main():
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
'User-Agent': 'okhttp/3.10.0',
'Stamp': get_stamp()}
data = {"pushRegId":"1","pushType":"GCM","uuid": str(uuid.uuid1())}
response = requests.post(url, json = data, headers = headers)
if response.status_code == 200:
Expand Down Expand Up @@ -93,7 +99,8 @@ def main():
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
'User-Agent': 'okhttp/3.10.0',
'Stamp': get_stamp()}
response = requests.get(url, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
Expand All @@ -117,7 +124,8 @@ def main():
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
'User-Agent': 'okhttp/3.10.0',
'Stamp': get_stamp()}
data = {"action":"prewakeup","deviceId": deviceId}
response = requests.post(url, json = data, headers = headers)
if response.status_code == 200:
Expand Down Expand Up @@ -152,7 +160,8 @@ def main():
headers = {
'Authorization': controlToken,
'ccsp-device-id': deviceId,
'Content-Type': 'application/json'}
'Content-Type': 'application/json',
'Stamp': get_stamp()}
response = requests.get(url, headers = headers)
if response.status_code == 200:
statusresponse = json.loads(response.text)
Expand Down
Loading

0 comments on commit bd2161f

Please sign in to comment.