From ec1b1e6a8ea20f6933830e6b0fe97af0bb9e198b Mon Sep 17 00:00:00 2001 From: "Alan D. Tse" Date: Sat, 30 Jan 2021 19:19:41 -0800 Subject: [PATCH 1/3] style: fix lint error --- teslajsonpy/connection.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/teslajsonpy/connection.py b/teslajsonpy/connection.py index b9c64bd0..9143b141 100644 --- a/teslajsonpy/connection.py +++ b/teslajsonpy/connection.py @@ -216,7 +216,7 @@ async def __open( f'{data.get("error")}:{data.get("error_description")}' ) except aiohttp.ClientResponseError as exception_: - raise TeslaException(exception_.status) + raise TeslaException(exception_.status) from exception_ return data async def websocket_connect(self, vin: int, vehicle_id: int, **kwargs): @@ -434,10 +434,10 @@ async def refresh_access_token(self, refresh_token): "refresh_token": refresh_token, "scope": "openid email offline_access", } - auth = await self.__open( - "/oauth2/v3/token", "post", data=oauth, baseurl="https://auth.tesla.com", + auth = await self.websession.post( + "https://auth.tesla.com/oauth2/v3/token", data=oauth, ) - return auth + return await auth.json() async def get_bearer_token(self, access_token): """Get bearer token. This is used by the owners API.""" From 0c2a0c27a2d5bb72ddcfb745ddaf15179c87bfad Mon Sep 17 00:00:00 2001 From: "Alan D. Tse" Date: Sat, 30 Jan 2021 19:21:41 -0800 Subject: [PATCH 2/3] style: fix lint error --- teslajsonpy/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teslajsonpy/connection.py b/teslajsonpy/connection.py index b9c64bd0..bcf7d727 100644 --- a/teslajsonpy/connection.py +++ b/teslajsonpy/connection.py @@ -216,7 +216,7 @@ async def __open( f'{data.get("error")}:{data.get("error_description")}' ) except aiohttp.ClientResponseError as exception_: - raise TeslaException(exception_.status) + raise TeslaException(exception_.status) from exception_ return data async def websocket_connect(self, vin: int, vehicle_id: int, **kwargs): From 2a3c15488b26f116a40156bdd8e3ae0b6d24ec01 Mon Sep 17 00:00:00 2001 From: "Alan D. Tse" Date: Sat, 30 Jan 2021 19:42:02 -0800 Subject: [PATCH 3/3] fix: add bs4 as dependency for install --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 51dba878..80734573 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ VERSION = None # What packages are required for this module to be executed? -REQUIRED = ["aiohttp", "backoff", "wrapt"] +REQUIRED = ["aiohttp", "backoff", "bs4", "wrapt"] # What packages are optional? EXTRAS = {