Skip to content
Snippets Groups Projects

Restructure and rename

1 file
+ 6
3
Compare changes
  • Side-by-side
  • Inline
+ 6
3
@@ -13,6 +13,7 @@ import requests
@@ -13,6 +13,7 @@ import requests
logger = logging.getLogger(__name__)
logger = logging.getLogger(__name__)
 
def is_valid_token(token: str) -> bool:
def is_valid_token(token: str) -> bool:
"""Check that the given token has not expired"""
"""Check that the given token has not expired"""
try:
try:
@@ -146,13 +147,13 @@ class ShoppingClient:
@@ -146,13 +147,13 @@ class ShoppingClient:
warn(
warn(
f"Connector {connector.name} specified but no data found for it "
f"Connector {connector.name} specified but no data found for it "
f"in shopping basket. Result will not contain an entry named {connector.name}."
f"in shopping basket. Result will not contain an entry named {connector.name}."
)
)
return {
return {
name: data.to_frame().T if data.ndim < 2 else data.T
name: data.to_frame().T if data.ndim < 2 else data.T
for name, data in converted_basket.items()
for name, data in converted_basket.items()
}
}
warn(
warn(
"No archive connectors specified - could not convert any basket items to Pandas DataFrame"
"No archive connectors specified - could not convert any basket items to Pandas DataFrame"
)
)
@@ -177,7 +178,9 @@ class ShoppingClient:
@@ -177,7 +178,9 @@ class ShoppingClient:
headers={"Authorization": f"token {jh_api_token}"},
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
return token
except KeyError:
except KeyError:
logger.warning("JupyterHub without Authstate enabled")
logger.warning("JupyterHub without Authstate enabled")
Loading