Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 04bc93a9 authored by LETORT Sebastien's avatar LETORT Sebastien
Browse files

Minor: tiny doc update and test method renamed.

parent e3a2222d
No related branches found
No related tags found
1 merge request!4Client api
...@@ -7,7 +7,7 @@ python 3.7: [![coverage report 3.7](https://gitlab.inria.fr/allgo/api-clients/py ...@@ -7,7 +7,7 @@ python 3.7: [![coverage report 3.7](https://gitlab.inria.fr/allgo/api-clients/py
## Description ## Description
AllGo is a SaaS (Software as a Service) platform provided by Inria. It may be seen as a virtual showroom of technologies developed by research teams. AllGo is a SaaS (Software as a Service) platform provided by Inria. It may be seen as a virtual showroom of technologies developed by research teams.
First follow https://allgo18.inria.fr/accounts/signup to create an account on AllGo (anyone may create such an account). Once your account creation is confirmed, please connect to https://allgo18.inria.fr to obtain your private token, which will allow yo to use the AllGo REST API. You will need this token later (cf. §3 below). First follow https://allgo18.inria.fr/accounts/signup to create an account on AllGo (anyone may create such an account). Once your account creation is confirmed, please connect to https://allgo18.inria.fr to obtain your private token, which will allow you to use the AllGo REST API. You will need this token later (cf. §3 below).
## Installing ## Installing
``` ```
...@@ -33,8 +33,9 @@ This will create a `_build` directory with all the html files. ...@@ -33,8 +33,9 @@ This will create a `_build` directory with all the html files.
├── doc ............... Documentations ├── doc ............... Documentations
├── MANIFEST.in ....... File needed to describe the package ├── MANIFEST.in ....... File needed to describe the package
├── notebooks ......... All the sample notebooks ├── notebooks ......... All the sample notebooks
├── pytest.ini ........ conf file for pytest
├── README.md ......... This file ! ├── README.md ......... This file !
├── requirements.txt .. List of requirements ├── requirements.txt .. List of requirement packages
├── setup.py .......... Package settings ├── setup.py .......... Package settings
└── tests ............. Directory of tests └── tests ............. Directory of tests
``` ```
......
...@@ -142,9 +142,9 @@ class Client: ...@@ -142,9 +142,9 @@ class Client:
token : string, optional token : string, optional
the user's token for the querying Allgo instance. the user's token for the querying Allgo instance.
if not provided, we check ALLGO_TOKEN env variable and TOKEN_FILE if not provided, we check ALLGO_TOKEN env variable and TOKEN_FILE
allgo_url : url, optional allgo_url : url, optional [=MAIN_INSTANCE_URL]
url of the Allgo instance to query. url of the Allgo instance to query.
verify_tls : bool, optional verify_tls : bool, optional [=True]
set to False if you don't want to force TLS verification (not recommanded). set to False if you don't want to force TLS verification (not recommanded).
Raises Raises
...@@ -377,7 +377,7 @@ class Client: ...@@ -377,7 +377,7 @@ class Client:
raise StatusError(resp.status_code, resp) raise StatusError(resp.status_code, resp)
return resp return resp
def download_file(self, *args, **kwargs): def download_file(self, file_url, outdir='.', force=False):
"""download the file pointed by the url. """download the file pointed by the url.
The file is downloaded in the outdir directory (which is created if not exist). The file is downloaded in the outdir directory (which is created if not exist).
...@@ -388,9 +388,9 @@ class Client: ...@@ -388,9 +388,9 @@ class Client:
---------- ----------
file_url : string/URL file_url : string/URL
the URL to download the file from. the URL to download the file from.
outdir : dirpath, optional outdir : dirpath, optional [='.']
the dirpath to write file to. the dirpath to write file to.
force : bool, optional force : bool, optional [=False]
set to true to force erasing existing file. set to true to force erasing existing file.
Returns Returns
...@@ -406,8 +406,8 @@ class Client: ...@@ -406,8 +406,8 @@ class Client:
with the Response status code if it's not 200. with the Response status code if it's not 200.
""" """
if 2 == sys.version_info.major: if 2 == sys.version_info.major:
return self.__download_file_p2(*args, **kwargs) return self.__download_file_p2(file_url, outdir, force)
return self.__download_file_p3(*args, **kwargs) return self.__download_file_p3(file_url, outdir, force)
def __download_file_p3(self, file_url, outdir='.', force=False): def __download_file_p3(self, file_url, outdir='.', force=False):
mode = 'wb' if force else 'xb' mode = 'wb' if force else 'xb'
...@@ -476,9 +476,9 @@ class Client: ...@@ -476,9 +476,9 @@ class Client:
all the app command line params as one string. all the app command line params as one string.
files : list of filepaths, optional files : list of filepaths, optional
filepaths to upload. filepaths to upload.
sleep_duration : int, optional sleep_duration : int, optional [=2]
number of seconds between 2 job_status queries. number of seconds between 2 job_status queries.
verbose : bool, optional verbose : bool, optional [=false]
if true, will print a message to show progression. if true, will print a message to show progression.
a dot will be printed each time a job_status query is made (like a progress bar), a dot will be printed each time a job_status query is made (like a progress bar),
so a dot each sleep_duration. so a dot each sleep_duration.
......
...@@ -342,7 +342,7 @@ def test_job_status__user_not_exist(mock_get, client): ...@@ -342,7 +342,7 @@ def test_job_status__user_not_exist(mock_get, client):
@pytest.mark.error @pytest.mark.error
@patch('allgo.requests.get') @patch('allgo.requests.get')
def test_job_status__error(mock_get, client): def test_job_status__unknown_id(mock_get, client):
# -- mock # -- mock
mock_get.return_value = Mock(status_code=404) mock_get.return_value = Mock(status_code=404)
mock_get.return_value.json.return_value = \ mock_get.return_value.json.return_value = \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment