Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 84993c76 authored by GARNIER Laurent's avatar GARNIER Laurent
Browse files

Update allgo/__init__.py

parent 8f5ed33c
No related branches found
No related tags found
1 merge request!5Jupyter token 2021
...@@ -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:
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment