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
0f6a73b2
Commit
0f6a73b2
authored
3 years ago
by
GARNIER Laurent
Browse files
Options
Downloads
Plain Diff
Merge branch 'jupyter-token_2021' into 'master'
Jupyter token 2021 See merge request
!5
parents
fc55d0dd
6841e947
No related branches found
Branches containing commit
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
+47
-1
47 additions, 1 deletion
allgo/__init__.py
with
47 additions
and
1 deletion
allgo/__init__.py
+
47
−
1
View file @
0f6a73b2
...
...
@@ -2,6 +2,7 @@ import logging
import
os
import
time
try
:
from
urllib.parse
import
urlparse
,
urlencode
from
urllib.request
import
urlopen
,
Request
...
...
@@ -13,8 +14,12 @@ except ImportError:
import
requests
log
=
logging
.
getLogger
(
'
allgo
'
)
__version__
=
'
0.1.11
'
# API version
__version__
=
'
0.2.1
'
# API token for JupyterLab
API_token
=
None
API_token_valid
=
False
def
local_token
():
from
os.path
import
expanduser
...
...
@@ -24,6 +29,47 @@ def local_token():
with
open
(
filetoken
)
as
f
:
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
"""
# if user.is_authenticated:
# print("User authenticated")
# else:
# print("User not authenticated")
# is token valid ?
if
not
API_token_valid
:
# Generate temp token
print
(
"
First:
"
+
API_token
+
"
\n
"
)
API_token
=
get_random_string
(
length
=
32
)
print
(
"
____
"
)
print
(
"
You need first to sign in with your existing https://allgo18.inria.fr/accounts/login/?token=
"
+
API_token
+
"
A||GO account
\n
"
)
print
(
"
____
"
)
else
:
# FIXME : Have to check that the user is register
print
(
"
____
"
)
msg
=
"
A||GO already initialized
\n
"
print
(
"
____
"
)
print
(
msg
)
class
App
:
"""
...
...
This diff is collapsed.
Click to expand it.
GARNIER Laurent
@lgarnier
mentioned in commit
853c760c
·
3 years ago
mentioned in commit
853c760c
mentioned in commit 853c760cdf08ea09588bfd5aa02477bfe4e929df
Toggle commit list
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