Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login again instead of refresh token #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
- id: prettier

- repo: https://github.com/psf/black
rev: 21.9b0
rev: 22.3.0
hooks:
- id: black

Expand Down
8 changes: 4 additions & 4 deletions pyuhoo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")
Expand Down