pycupra 0.0.7__py3-none-any.whl → 0.0.8__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/__version__.py +1 -1
- pycupra/connection.py +17 -0
- pycupra/vehicle.py +8 -3
- {pycupra-0.0.7.dist-info → pycupra-0.0.8.dist-info}/METADATA +1 -1
- pycupra-0.0.8.dist-info/RECORD +13 -0
- pycupra-0.0.7.dist-info/RECORD +0 -13
- {pycupra-0.0.7.dist-info → pycupra-0.0.8.dist-info}/WHEEL +0 -0
- {pycupra-0.0.7.dist-info → pycupra-0.0.8.dist-info}/licenses/LICENSE +0 -0
- {pycupra-0.0.7.dist-info → pycupra-0.0.8.dist-info}/top_level.txt +0 -0
pycupra/__version__.py
CHANGED
pycupra/connection.py
CHANGED
@@ -136,6 +136,10 @@ class Connection:
|
|
136
136
|
_LOGGER.info(f'Init PyCupra library, version {lib_version}')
|
137
137
|
_LOGGER.debug(f'Using service {self._session_base}')
|
138
138
|
|
139
|
+
self._sessionRequestCounter = 0
|
140
|
+
self._sessionRequestTimestamp = datetime.now(tz= None)
|
141
|
+
self._sessionRequestCounterHistory = {}
|
142
|
+
|
139
143
|
|
140
144
|
def _clear_cookies(self):
|
141
145
|
self._session._cookie_jar._cookies.clear()
|
@@ -604,6 +608,19 @@ class Connection:
|
|
604
608
|
"""Perform a HTTP query"""
|
605
609
|
if self._session_fulldebug:
|
606
610
|
_LOGGER.debug(f'HTTP {method} "{url}"')
|
611
|
+
try:
|
612
|
+
if datetime.now(tz=None).date() != self._sessionRequestTimestamp.date():
|
613
|
+
# A new day has begun. Store _sessionRequestCounter in history and reset timestamp and counter
|
614
|
+
self._sessionRequestCounterHistory[self._sessionRequestTimestamp.strftime('%Y-%m-%d')]=self._sessionRequestCounter
|
615
|
+
_LOGGER.info(f'History of the number of API calls:')
|
616
|
+
for key, value in self._sessionRequestCounterHistory.items:
|
617
|
+
_LOGGER.info(f' Date: {key}: {value} API calls')
|
618
|
+
|
619
|
+
self._sessionRequestTimestamp= datetime.now(tz=None)
|
620
|
+
self._sessionRequestCounter = 0
|
621
|
+
except Exception as e:
|
622
|
+
_LOGGER.error(f'Error while preparing output of API call history. Error: {e}')
|
623
|
+
self._sessionRequestCounter = self._sessionRequestCounter + 1
|
607
624
|
async with self._session.request(
|
608
625
|
method,
|
609
626
|
url,
|
pycupra/vehicle.py
CHANGED
@@ -74,6 +74,9 @@ class Vehicle:
|
|
74
74
|
'transactionHistoryHonkFlash': {'active': False, 'reason': 'not supported'},
|
75
75
|
}
|
76
76
|
|
77
|
+
self._last_full_update = datetime.now(tz=None) - timedelta(seconds=1200)
|
78
|
+
|
79
|
+
|
77
80
|
#### API get and set functions ####
|
78
81
|
# Init and update vehicle data
|
79
82
|
async def discover(self):
|
@@ -132,7 +135,7 @@ class Vehicle:
|
|
132
135
|
return_exceptions=True
|
133
136
|
)
|
134
137
|
|
135
|
-
fullUpdateExpired = datetime.now(
|
138
|
+
fullUpdateExpired = datetime.now(tz=None) - timedelta(seconds= 1100)
|
136
139
|
if hasattr(self, '_last_full_update'):
|
137
140
|
_LOGGER.debug(f'last_full_update= {self._last_full_update}, fullUpdateExpired= {fullUpdateExpired}.')
|
138
141
|
if updateType!=1 and (hasattr(self, '_last_full_update') and self._last_full_update>fullUpdateExpired):
|
@@ -153,8 +156,9 @@ class Vehicle:
|
|
153
156
|
#self.get_modelimageurl(), #commented out, because getting the images discover() should be sufficient
|
154
157
|
return_exceptions=True
|
155
158
|
)
|
156
|
-
self._last_full_update = datetime.now(
|
159
|
+
self._last_full_update = datetime.now(tz=None)
|
157
160
|
_LOGGER.debug(f'Performed full update for vehicle with VIN {self.vin}.')
|
161
|
+
_LOGGER.debug(f'So far about {self._connection._sessionRequestCounter} API calls since {self._connection._sessionRequestTimestamp}.')
|
158
162
|
except:
|
159
163
|
raise SeatException("Update failed")
|
160
164
|
return True
|
@@ -1259,7 +1263,8 @@ class Vehicle:
|
|
1259
1263
|
@property
|
1260
1264
|
def is_last_full_update_supported(self):
|
1261
1265
|
"""Return when last full update for vehicle took place."""
|
1262
|
-
|
1266
|
+
if hasattr(self,'_last_full_update'):
|
1267
|
+
return True
|
1263
1268
|
|
1264
1269
|
# Service information
|
1265
1270
|
@property
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pycupra
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.8
|
4
4
|
Summary: A library to read and send vehicle data via Cupra/Seat portal using the same API calls as the MyCupra/MySeat mobile app.
|
5
5
|
Home-page: https://github.com/WulfgarW/pycupra
|
6
6
|
Author: WulfgarW
|
@@ -0,0 +1,13 @@
|
|
1
|
+
pycupra/__init__.py,sha256=VPzUfKd5mBFD1UERNV61FbGHih5dQPupLgIfYtmIUi4,230
|
2
|
+
pycupra/__version__.py,sha256=g845Cq_z0hjlwG9RG4nM9vit4t_cEbb5HkAMZ7Iav3Y,207
|
3
|
+
pycupra/connection.py,sha256=fNjyrj6nBLOfEpKcygDs47UFlWjmR4tgJa1KPLLNZLU,82411
|
4
|
+
pycupra/const.py,sha256=VEYH8TUsJGJwBwloaajwoElYd0qxE7oesvoagvDdE-4,10161
|
5
|
+
pycupra/dashboard.py,sha256=Dqs4qDF-rEoYXoS7NrNsvRMsCGzoAjVUEbfTSOdDAXo,41310
|
6
|
+
pycupra/exceptions.py,sha256=Nq_F79GP8wjHf5lpvPy9TbSIrRHAJrFMo0T1N9TcgSQ,2917
|
7
|
+
pycupra/utilities.py,sha256=cH4MiIzT2WlHgmnl_E7rR0R5LvCXfDNvirJolct50V8,2563
|
8
|
+
pycupra/vehicle.py,sha256=J5jUAseVTtb9HK0-RvCi-VzkJ1z0h4Phn_Tgno6Sgzk,122420
|
9
|
+
pycupra-0.0.8.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
10
|
+
pycupra-0.0.8.dist-info/METADATA,sha256=Z8QMsbcu3IXFWgeNLKTk91sGirawTdhXhEoCqFvhAPs,2578
|
11
|
+
pycupra-0.0.8.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
12
|
+
pycupra-0.0.8.dist-info/top_level.txt,sha256=9Lbj_jG4JvpGwt6K3AwhWFc0XieDnuHFOP4x44wSXSQ,8
|
13
|
+
pycupra-0.0.8.dist-info/RECORD,,
|
pycupra-0.0.7.dist-info/RECORD
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
pycupra/__init__.py,sha256=VPzUfKd5mBFD1UERNV61FbGHih5dQPupLgIfYtmIUi4,230
|
2
|
-
pycupra/__version__.py,sha256=sE47EQF8GjjvZy9jhhygnhK2JLO76vFrSBB6HfkoIW4,207
|
3
|
-
pycupra/connection.py,sha256=LK1v3Eb37lbVKIbQWIjn4xAIAFJqxXwlguX5iq2Ylm8,81393
|
4
|
-
pycupra/const.py,sha256=VEYH8TUsJGJwBwloaajwoElYd0qxE7oesvoagvDdE-4,10161
|
5
|
-
pycupra/dashboard.py,sha256=Dqs4qDF-rEoYXoS7NrNsvRMsCGzoAjVUEbfTSOdDAXo,41310
|
6
|
-
pycupra/exceptions.py,sha256=Nq_F79GP8wjHf5lpvPy9TbSIrRHAJrFMo0T1N9TcgSQ,2917
|
7
|
-
pycupra/utilities.py,sha256=cH4MiIzT2WlHgmnl_E7rR0R5LvCXfDNvirJolct50V8,2563
|
8
|
-
pycupra/vehicle.py,sha256=cEg7wG4WX6p4MfShRGZZ955cqvYERI6CmfWSN5NanSQ,122147
|
9
|
-
pycupra-0.0.7.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
10
|
-
pycupra-0.0.7.dist-info/METADATA,sha256=0W-3PCD7jSDrUtYauZKSzFfSe_dzbTqREQjNxlv28Qo,2578
|
11
|
-
pycupra-0.0.7.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
12
|
-
pycupra-0.0.7.dist-info/top_level.txt,sha256=9Lbj_jG4JvpGwt6K3AwhWFc0XieDnuHFOP4x44wSXSQ,8
|
13
|
-
pycupra-0.0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|