pycupra 0.0.1__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.
- pycupra/__init__.py +7 -0
- pycupra/__version__.py +6 -0
- pycupra/connection.py +1617 -0
- pycupra/const.py +180 -0
- pycupra/dashboard.py +1258 -0
- pycupra/exceptions.py +87 -0
- pycupra/utilities.py +116 -0
- pycupra/vehicle.py +2556 -0
- pycupra-0.0.1.dist-info/METADATA +57 -0
- pycupra-0.0.1.dist-info/RECORD +13 -0
- pycupra-0.0.1.dist-info/WHEEL +5 -0
- pycupra-0.0.1.dist-info/licenses/LICENSE +201 -0
- pycupra-0.0.1.dist-info/top_level.txt +1 -0
pycupra/const.py
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
"""Constants for pycupra library."""
|
2
|
+
|
3
|
+
BASE_SESSION = 'https://ola.prod.code.seat.cloud.vwgroup.com'
|
4
|
+
BASE_AUTH = 'https://identity.vwgroup.io'
|
5
|
+
|
6
|
+
# Data used in communication
|
7
|
+
CLIENT_LIST = {
|
8
|
+
'seat': {
|
9
|
+
'CLIENT_ID': '99a5b77d-bd88-4d53-b4e5-a539c60694a3@apps_vw-dilab_com',
|
10
|
+
'SCOPE': 'openid profile nickname birthdate phone',
|
11
|
+
'REDIRECT_URL': 'seat://oauth-callback',
|
12
|
+
'TOKEN_TYPES': 'code id_token token'
|
13
|
+
},
|
14
|
+
'cupra': {
|
15
|
+
'CLIENT_ID': '3c756d46-f1ba-4d78-9f9a-cff0d5292d51@apps_vw-dilab_com',
|
16
|
+
'CLIENT_SECRET': 'eb8814e641c81a2640ad62eeccec11c98effc9bccd4269ab7af338b50a94b3a2',
|
17
|
+
'SCOPE': 'openid profile nickname birthdate phone',
|
18
|
+
'REDIRECT_URL': 'cupra://oauth-callback',
|
19
|
+
'TOKEN_TYPES': 'code id_token token'
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
XCLIENT_ID = '3c756d46-f1ba-4d78-9f9a-cff0d5292d51@apps_vw-dilab.com'
|
25
|
+
XAPPVERSION = '2.5.0'
|
26
|
+
XAPPNAME = 'com.cupra.mycupra'
|
27
|
+
USER_AGENT_CUPRA = 'OLACupra/2.5.0 (Android 12; sdk_gphone64_x86_64; Google) Mobile'
|
28
|
+
USER_AGENT_SEAT = 'OLASeat/2.5.0 (Android 12; sdk_gphone64_x86_64; Google) Mobile'
|
29
|
+
APP_URI = 'https://ola.prod.code.seat.cloud.vwgroup.com'
|
30
|
+
|
31
|
+
HEADERS_SESSION = {
|
32
|
+
'seat': {
|
33
|
+
'Connection': 'keep-alive',
|
34
|
+
'Content-Type': 'application/json',
|
35
|
+
'Accept-charset': 'UTF-8',
|
36
|
+
'Accept': 'application/json',
|
37
|
+
#'X-Client-Id': XCLIENT_ID,
|
38
|
+
#'X-App-Version': XAPPVERSION,
|
39
|
+
#'X-App-Name': XAPPNAME,
|
40
|
+
'User-Agent': USER_AGENT_SEAT
|
41
|
+
#'User-ID': '?????', # to be set later
|
42
|
+
},
|
43
|
+
'cupra': {
|
44
|
+
'Connection': 'keep-alive',
|
45
|
+
'Content-Type': 'application/json',
|
46
|
+
'Accept-charset': 'UTF-8',
|
47
|
+
'Accept': 'application/json',
|
48
|
+
#'X-Client-Id': XCLIENT_ID,
|
49
|
+
#'X-App-Version': XAPPVERSION,
|
50
|
+
#'X-App-Name': XAPPNAME,
|
51
|
+
'User-Agent': USER_AGENT_CUPRA
|
52
|
+
#'User-ID': '?????', # to be set later
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
HEADERS_AUTH = {
|
57
|
+
'seat': {
|
58
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
59
|
+
'User-Agent': USER_AGENT_SEAT,
|
60
|
+
'Accept': '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',
|
61
|
+
'x-requested-with': XAPPNAME,
|
62
|
+
'Accept-Encoding': 'gzip, deflate',
|
63
|
+
'Connection': 'keep-alive',
|
64
|
+
#'X-App-Name': XAPPNAME
|
65
|
+
},
|
66
|
+
'cupra':{
|
67
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
68
|
+
'User-Agent': USER_AGENT_CUPRA,
|
69
|
+
'Accept': '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',
|
70
|
+
'x-requested-with': XAPPNAME,
|
71
|
+
'Accept-Encoding': 'gzip, deflate',
|
72
|
+
'Connection': 'keep-alive',
|
73
|
+
#'X-App-Name': XAPPNAME
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
TOKEN_HEADERS = {
|
78
|
+
'seat': {
|
79
|
+
'Accept': 'application/json',
|
80
|
+
'X-Platform': 'Android',
|
81
|
+
#'X-Language-Id': 'XX',
|
82
|
+
#'X-Country-Id': 'XX',
|
83
|
+
#'Accept-Language': 'XX',
|
84
|
+
'Accept-Charset': 'UTF-8',
|
85
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
86
|
+
'Connection': 'keep-alive',
|
87
|
+
'Accept-Encoding': 'gzip',
|
88
|
+
'User-Agent': USER_AGENT_SEAT,
|
89
|
+
'app-version': '2.5.0',
|
90
|
+
'app-brand': 'seat',
|
91
|
+
'app-market': 'android',
|
92
|
+
#'User-ID': '?????', # to be set later
|
93
|
+
'Authorization': 'Bearer'
|
94
|
+
},
|
95
|
+
'cupra': {
|
96
|
+
'Accept': 'application/json',
|
97
|
+
'X-Platform': 'Android',
|
98
|
+
#'X-Language-Id': 'XX',
|
99
|
+
#'X-Country-Id': 'XX',
|
100
|
+
#'Accept-Language': 'XX',
|
101
|
+
'Accept-Charset': 'UTF-8',
|
102
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
103
|
+
'Connection': 'keep-alive',
|
104
|
+
'Accept-Encoding': 'gzip',
|
105
|
+
'User-Agent': USER_AGENT_CUPRA,
|
106
|
+
'app-version': '2.5.0',
|
107
|
+
'app-brand': 'cupra',
|
108
|
+
'app-market': 'android',
|
109
|
+
#'User-ID': '?????', # to be set later
|
110
|
+
'Authorization': 'Bearer'
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
#ERROR_CODES = {
|
115
|
+
# '11': 'Charger not connected'
|
116
|
+
#}
|
117
|
+
|
118
|
+
### API Endpoints below, not yet in use ###
|
119
|
+
# API AUTH endpoints
|
120
|
+
AUTH_OIDCONFIG = 'https://identity.vwgroup.io/.well-known/openid-configuration' # OpenID configuration
|
121
|
+
AUTH_TOKEN = 'https://identity.vwgroup.io/oidc/v1/token' # Endpoint for exchanging code for token
|
122
|
+
AUTH_REFRESH = 'https://ola.prod.code.seat.cloud.vwgroup.com/authorization/api/v1/token' # Endpoint for token refresh (also used for exchanging code for token for Seat)
|
123
|
+
AUTH_TOKENKEYS = 'https://identity.vwgroup.io/oidc/v1/keys' # Signing keys for tokens
|
124
|
+
|
125
|
+
# API endpoints
|
126
|
+
API_MBB_STATUSDATA = 'https://customer-profile.vwgroup.io/v3/customers/{self._user_id}/mbbStatusData'
|
127
|
+
API_PERSONAL_DATA= 'https://customer-profile.vwgroup.io/v3/customers/{self._user_id}/personalData'
|
128
|
+
API_VEHICLES = '{APP_URI}/v2/users/{self._user_id}/garage/vehicles' # Garage info
|
129
|
+
API_MYCAR = '{baseurl}/v5/users/{self._user_id}/vehicles/{vin}/mycar' # Vehicle status report
|
130
|
+
API_CHARGING = '{baseurl}/v1/vehicles/{vin}/charging' # Vehicle charging information
|
131
|
+
#API_OPERLIST = '{homeregion}/api/rolesrights/operationlist/v3/vehicles/{vin}' # API Endpoint for supported operations
|
132
|
+
#API_CHARGER = 'fs-car/bs/batterycharge/v1/{BRAND}/{COUNTRY}/vehicles/{vin}/charger' # Charger data
|
133
|
+
API_CLIMATER_STATUS = '{baseurl}/v1/vehicles/{vin}/climatisation/status' # Climatisation data
|
134
|
+
API_CLIMATER = '{baseurl}/v2/vehicles/{vin}/climatisation' # Climatisation data
|
135
|
+
API_DEPARTURE_TIMERS = '{baseurl}/v1/vehicles/{vin}/departure-timers' # Departure timers
|
136
|
+
API_POSITION = '{baseurl}/v1/vehicles/{vin}/parkingposition' # Position data
|
137
|
+
API_POS_TO_ADDRESS= 'https://maps.googleapis.com/maps/api/directions/json?origin={lat},{lon}&destination={lat},{lon}&traffic_model=best_guess&departure_time=now&language=de&key={apiKeyForGoogle}&mode=driving'
|
138
|
+
API_TRIP = '{baseurl}/v1/vehicles/{vin}/driving-data/{dataType}?from=1970-01-01T00:00:00Z&to=2099-12-31T09:59:01Z' # Trip statistics (whole history) SHORT/LONG/CYCLIC (WEEK only with from)
|
139
|
+
API_MILEAGE = '{baseurl}/v1/vehicles/{vin}/mileage' # Total km etc
|
140
|
+
API_MAINTENANCE = '{baseurl}/v1/vehicles/{vin}/maintenance' # Inspection information
|
141
|
+
API_MEASUREMENTS = '{baseurl}/v1/vehicles/{vin}/measurements/engines' # ???
|
142
|
+
API_STATUS = '{baseurl}/v2/vehicles/{vin}/status' # Status information like locks and windows
|
143
|
+
API_WARNINGLIGHTS = '{baseurl}/v3/vehicles/{vin}/warninglights' # ???
|
144
|
+
API_SHOP = '{baseurl}/v1/shop/vehicles/{vin}/articles' # ???
|
145
|
+
#API_ACTION = '{baseurl}/v1/vehicles/{vin}/{action}/requests/{command}' # Actions (e.g. ActionCharge="charging", ActionChargeStart="start",ActionChargeStop="stop")
|
146
|
+
API_RELATION_STATUS = '{baseurl}/v1/users/{self._user_id}/vehicles/{vin}/relation-status' # ???
|
147
|
+
API_INVITATIONS = '{baseurl}/v1/user/{self._user_id}/invitations' # ???
|
148
|
+
API_CAPABILITIES = '{APP_URI}/v1/user/{self._user_id}/vehicle/{vin}/capabilities' # ???
|
149
|
+
#API_CAPABILITIES_MANAGEMENT = '{API_CAPABILITIES}/management' # ???
|
150
|
+
API_IMAGE = '{baseurl}/v1/vehicles/{vin}/renders'
|
151
|
+
API_HONK_AND_FLASH = '{baseurl}//v1/vehicles/{vin}/honk-and-flash'
|
152
|
+
API_ACCESS = '{baseurl}//v1/vehicles/{vin}/access/{action}' # to lock or unlock vehicle
|
153
|
+
API_REQUESTS = '{baseurl}/vehicles/{vin}/{capability}/requests'
|
154
|
+
API_REFRESH = '{baseurl}/v1/vehicles/{vin}/vehicle-wakeup/request'
|
155
|
+
API_SECTOKEN = '{baseurl}/v2/users/{self._user_id}/spin/verify'
|
156
|
+
API_DESTINATION = '{baseurl}/v1/users/vehicles/{vin}/destination'
|
157
|
+
API_LITERALS= '{APP_URI}/v1/content/apps/my-cupra/literals/{language}' # Message texts in different langauages, e.g. 'en_GB'
|
158
|
+
|
159
|
+
# Still to analyse if needed
|
160
|
+
#'{baseurl}/settings/api/v1?vin={vin}&vehicle-model=LeonST®ion=US&enrolment-country=DE&platform=MOD3'
|
161
|
+
#'{baseurl}/v1/users/{self._user_id}/vin/{vin}/terms-and-conditions'
|
162
|
+
#'{baseurl}/v2/subscriptions'
|
163
|
+
#'{baseurl}/v1/users/{self._user_id}/vehicles/{vin}/leads/history'
|
164
|
+
#'{baseurl}/v1/users/{self._user-id}/vehicles/{vin}/consents/xxcryptickeyxxx?locale=en_DE' #{"userId":"xxxxxxx","locale":"en_DE","error":{"title":"Consent failed to load.","detail":"CUPRAApp_ME3_Vehicle_VehiclePermissions_MainViewAccepted_Low_Type1_Wrong"}}
|
165
|
+
|
166
|
+
API_CONNECTION= '{APP_URI}/vehicles/{vin}/connection'
|
167
|
+
#API_CONSENTS='{APP_URI}/v1/users/{self._user_id}/consents'
|
168
|
+
API_PSP='{baseurl}/v2/users/{self._user_id}/vehicles/{vin}/psp' # primary service provider (Werkstatt)
|
169
|
+
API_USER_INFO= 'https://identity-userinfo.vwgroup.io/oidc/userinfo' #{"sub":"xxx","name":"xxx","given_name":"xxx","family_name":"xxx","nickname":"xxx","email":"###","email_verified":true,"birthdate":"###","updated_at":123456789,"picture":"https://customer-pictures.vwgroup.io/v1/###/profile-picture"}
|
170
|
+
|
171
|
+
PUBLIC_MODEL_IMAGES_SERVER = 'prod-ola-public-bucket.s3.eu-central-1.amazonaws.com' # non-indivdual model images are on this server
|
172
|
+
|
173
|
+
# API endpoints for status
|
174
|
+
REQ_STATUS = {
|
175
|
+
'climatisation': 'fs-car/bs/climatisation/v1/{BRAND}/{COUNTRY}/vehicles/{vin}/climater/actions/{id}',
|
176
|
+
'batterycharge': 'fs-car/bs/batterycharge/v1/{BRAND}/{COUNTRY}/vehicles/{vin}/charger/actions/{id}',
|
177
|
+
'departuretimer': 'fs-car/bs/departuretimer/v1/{BRAND}/{COUNTRY}/vehicles/{vin}/timer/actions/{id}',
|
178
|
+
'vsr': 'fs-car/bs/vsr/v1/{BRAND}/{COUNTRY}/vehicles/{vin}/requests/{id}/jobstatus',
|
179
|
+
'default': 'fs-car/bs/{section}/v1/{BRAND}/{COUNTRY}/vehicles/{vin}/requests/{id}/status'
|
180
|
+
}
|