pycupra 0.0.8__py3-none-any.whl → 0.0.10__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 CHANGED
@@ -3,4 +3,4 @@ pycupra - A Python 3 library for interacting with the My Cupra/My Seat portal.
3
3
 
4
4
  For more details and documentation, visit the github page at https://github.com/WulfgarW/pycupra
5
5
  """
6
- __version__ = "0.0.8"
6
+ __version__ = "0.0.10"
pycupra/connection.py CHANGED
@@ -24,7 +24,7 @@ from json import dumps as to_json
24
24
  from jwt.exceptions import ExpiredSignatureError
25
25
  import aiohttp
26
26
  from bs4 import BeautifulSoup
27
- from base64 import b64decode, b64encode
27
+ from base64 import b64decode, b64encode, urlsafe_b64decode, urlsafe_b64encode
28
28
  from .__version__ import __version__ as lib_version
29
29
  from .utilities import read_config, json_loads
30
30
  from .vehicle import Vehicle
@@ -43,7 +43,6 @@ from .exceptions import (
43
43
  )
44
44
 
45
45
  from requests_oauthlib import OAuth2Session
46
- import base64
47
46
  from oauthlib.oauth2.rfc6749.parameters import parse_authorization_code_response, parse_token_response, prepare_grant_uri
48
47
 
49
48
  from aiohttp import ClientSession, ClientTimeout
@@ -267,10 +266,10 @@ class Connection:
267
266
  authorizationEndpoint = response_data['authorization_endpoint']
268
267
  authissuer = response_data['issuer']
269
268
  oauthClient = OAuth2Session(client_id=CLIENT_LIST[client].get('CLIENT_ID'), scope=CLIENT_LIST[client].get('SCOPE'), redirect_uri=CLIENT_LIST[client].get('REDIRECT_URL'))
270
- code_verifier = base64.urlsafe_b64encode(os.urandom(40)).decode('utf-8')
269
+ code_verifier = urlsafe_b64encode(os.urandom(40)).decode('utf-8')
271
270
  code_verifier = re.sub('[^a-zA-Z0-9]+', '', code_verifier)
272
271
  code_challenge = hashlib.sha256(code_verifier.encode("utf-8")).digest()
273
- code_challenge = base64.urlsafe_b64encode(code_challenge).decode("utf-8")
272
+ code_challenge = urlsafe_b64encode(code_challenge).decode("utf-8")
274
273
  code_challenge = code_challenge.replace("=", "")
275
274
  authorization_url, state = oauthClient.authorization_url(authorizationEndpoint, code_challenge=code_challenge, code_challenge_method='S256',
276
275
  nonce=self._session_nonce, state=self._session_state)
pycupra/dashboard.py CHANGED
@@ -341,7 +341,7 @@ class DoorLock(Instrument):
341
341
  async def lock(self):
342
342
  try:
343
343
  response = await self.vehicle.set_lock('lock', self.spin)
344
- await self.vehicle.update()
344
+ #await self.vehicle.update()
345
345
  if self.callback is not None:
346
346
  self.callback()
347
347
  return response
@@ -352,7 +352,7 @@ class DoorLock(Instrument):
352
352
  async def unlock(self):
353
353
  try:
354
354
  response = await self.vehicle.set_lock('unlock', self.spin)
355
- await self.vehicle.update()
355
+ #await self.vehicle.update()
356
356
  if self.callback is not None:
357
357
  self.callback()
358
358
  return response
@@ -365,7 +365,7 @@ class DoorLock(Instrument):
365
365
  return dict(last_result = self.vehicle.lock_action_status)
366
366
 
367
367
 
368
- class TrunkLock(Instrument):
368
+ """class TrunkLock(Instrument):
369
369
  def __init__(self):
370
370
  super().__init__(component="lock", attr="trunk_locked", name="Trunk locked")
371
371
 
@@ -385,12 +385,12 @@ class TrunkLock(Instrument):
385
385
  def is_locked(self):
386
386
  return self.state
387
387
 
388
- async def lock(self):
389
- return None
390
-
391
- async def unlock(self):
392
- return None
388
+ #async def lock(self):
389
+ # return None
393
390
 
391
+ #async def unlock(self):
392
+ # return None
393
+ """
394
394
  # Switches
395
395
  class RequestHonkAndFlash(Switch):
396
396
  def __init__(self):
@@ -938,7 +938,7 @@ def create_instruments():
938
938
  return [
939
939
  Position(),
940
940
  DoorLock(),
941
- TrunkLock(),
941
+ #TrunkLock(),
942
942
  RequestFlash(),
943
943
  RequestHonkAndFlash(),
944
944
  RequestRefresh(),