Skip to content
Snippets Groups Projects
Commit 8e541e3d authored by John Swinbank's avatar John Swinbank
Browse files

Tweak formatting

parent d54dfc27
No related branches found
No related tags found
1 merge request!12Smarter handling of tokens
......@@ -13,6 +13,7 @@ import requests
logger = logging.getLogger(__name__)
def is_valid_token(token: str) -> bool:
"""Check that the given token has not expired"""
try:
......@@ -177,7 +178,9 @@ class ShoppingClient:
headers={"Authorization": f"token {jh_api_token}"},
)
if is_valid_token(token := res.json()["auth_state"]["exchanged_tokens"][self.audience]):
if is_valid_token(
token := res.json()["auth_state"]["exchanged_tokens"][self.audience]
):
return token
except KeyError:
logger.warning("JupyterHub without Authstate enabled")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment