Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
esap-userprofile-python-client
Manage
Activity
Members
Labels
Plan
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASTRON SDC
ESCAPE WP5
esap-userprofile-python-client
Commits
8e541e3d
Commit
8e541e3d
authored
3 years ago
by
John Swinbank
Browse files
Options
Downloads
Patches
Plain Diff
Tweak formatting
parent
d54dfc27
No related branches found
No related tags found
1 merge request
!12
Smarter handling of tokens
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
esap_client/shopping_client.py
+6
-3
6 additions, 3 deletions
esap_client/shopping_client.py
with
6 additions
and
3 deletions
esap_client/shopping_client.py
+
6
−
3
View file @
8e541e3d
...
...
@@ -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
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment