Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python_client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
allgo
API-Clients
python_client
Commits
84993c76
Commit
84993c76
authored
3 years ago
by
GARNIER Laurent
Browse files
Options
Downloads
Patches
Plain Diff
Update allgo/__init__.py
parent
8f5ed33c
No related branches found
No related tags found
1 merge request
!5
Jupyter token 2021
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
allgo/__init__.py
+28
-0
28 additions, 0 deletions
allgo/__init__.py
with
28 additions
and
0 deletions
allgo/__init__.py
+
28
−
0
View file @
84993c76
...
@@ -24,6 +24,34 @@ def local_token():
...
@@ -24,6 +24,34 @@ def local_token():
with
open
(
filetoken
)
as
f
:
with
open
(
filetoken
)
as
f
:
return
f
.
read
()
return
f
.
read
()
class
Init
:
"""
manage initialization of the API.
check if there is an existing token
| No: generate a temporary token and return the allgo login page
| Yes: Display
"
Allgo is already initialized
"
"""
def
__init__
(
self
):
"""
Initialization of Allgo-instance.
Parameters
----------
Returns
-------
string
allgo login page link or already initialized message
"""
self
.
_token
=
token
or
os
.
getenv
(
'
ALLGO_TOKEN
'
)
or
_local_token
()
if
None
is
self
.
_token
:
tmp_token
=
get_random_string
(
length
=
32
)
msg
=
"
allgo_token =
"
+
tmp_token
msg
+=
"
<p>Sign in with your existing <a href=
\"
https://allgo18.inria.fr/accounts/login/?token=
"
+
tmp_token
+
"
\"
>A||GO account </a></p>
"
return
msg
else
:
msg
=
"
<p>A||GO already initialized</p>
"
return
msg
class
App
:
class
App
:
"""
"""
...
...
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