From 80841c16c0d76df390a01b3585e0a32d0a27ee61 Mon Sep 17 00:00:00 2001 From: startledhighlandhippo Date: Sun, 5 Jun 2022 12:58:10 -0400 Subject: [PATCH] Update to login again when the token expires instead of attempting to refresh the token because refreshing the token is broken --- .pre-commit-config.yaml | 2 +- pyuhoo/client.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f4b3c7a..946b189 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: prettier - repo: https://github.com/psf/black - rev: 21.9b0 + rev: 22.3.0 hooks: - id: black diff --git a/pyuhoo/client.py b/pyuhoo/client.py index 9df6129..f88d69c 100644 --- a/pyuhoo/client.py +++ b/pyuhoo/client.py @@ -101,18 +101,18 @@ async def get_latest_data(self) -> None: except UnauthorizedError: self._log.debug( "\033[93m" - + "[get_latest_data] received 401 error, refreshing token and trying again" + + "[get_latest_data] received 401 error, attempting to re-login and trying again" + "\033[0m" ) - await self.refresh_token() + await self.login() data_latest = await self._api.data_latest() except ForbiddenError: self._log.debug( "\033[93m" - + "[get_latest_data] received 403 error, refreshing token and trying again" + + "[get_latest_data] received 403 error, attempting to re-login and trying again" + "\033[0m" ) - await self.refresh_token() + await self.login() data_latest = await self._api.data_latest() # self._log.debug(f"[data_latest] returned\n{json_pp(data_latest)}")