From 2d3e9a509b48dc1a82279353c894addac32a2518 Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Sat, 14 Dec 2024 22:40:54 +0100 Subject: [PATCH] Update code type handling --- custom_components/polestar_api/pypolestar/auth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/polestar_api/pypolestar/auth.py b/custom_components/polestar_api/pypolestar/auth.py index 7b1530f..9d9fa93 100644 --- a/custom_components/polestar_api/pypolestar/auth.py +++ b/custom_components/polestar_api/pypolestar/auth.py @@ -145,12 +145,12 @@ async def get_token(self, refresh=False) -> None: self.logger.debug("Access token updated, valid until %s", self.token_expiry) - async def _get_code(self) -> None: + async def _get_code(self) -> str | None: query_params = await self._get_resume_path() # check if code is in query_params - if query_params.get("code"): - return query_params.get("code") + if code := query_params.get("code"): + return code # get the resume path if not (resume_path := query_params.get("resumePath")):