diff --git a/README.md b/README.md index 78bfdaef04bfa226a219995e2f6e9c433bdc0932..afc60127b9ea7e362f6535e59e7abb1880438c97 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ python 3.7: [ 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 ``` @@ -33,8 +33,9 @@ This will create a `_build` directory with all the html files. ├── doc ............... Documentations ├── MANIFEST.in ....... File needed to describe the package ├── notebooks ......... All the sample notebooks +├── pytest.ini ........ conf file for pytest ├── README.md ......... This file ! -├── requirements.txt .. List of requirements +├── requirements.txt .. List of requirement packages ├── setup.py .......... Package settings └── tests ............. Directory of tests ``` diff --git a/allgo/__init__.py b/allgo/__init__.py index 67fba8a3d15787806c3affc9bf4b3f9c8c0b503d..d3de83f0777782c88a5c91e35fb4645b350fa63d 100644 --- a/allgo/__init__.py +++ b/allgo/__init__.py @@ -142,9 +142,9 @@ class Client: token : string, optional the user's token for the querying Allgo instance. 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. - verify_tls : bool, optional + verify_tls : bool, optional [=True] set to False if you don't want to force TLS verification (not recommanded). Raises @@ -377,7 +377,7 @@ class Client: raise StatusError(resp.status_code, 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. The file is downloaded in the outdir directory (which is created if not exist). @@ -388,9 +388,9 @@ class Client: ---------- file_url : string/URL the URL to download the file from. - outdir : dirpath, optional + outdir : dirpath, optional [='.'] the dirpath to write file to. - force : bool, optional + force : bool, optional [=False] set to true to force erasing existing file. Returns @@ -406,8 +406,8 @@ class Client: with the Response status code if it's not 200. """ if 2 == sys.version_info.major: - return self.__download_file_p2(*args, **kwargs) - return self.__download_file_p3(*args, **kwargs) + return self.__download_file_p2(file_url, outdir, force) + return self.__download_file_p3(file_url, outdir, force) def __download_file_p3(self, file_url, outdir='.', force=False): mode = 'wb' if force else 'xb' @@ -476,9 +476,9 @@ class Client: all the app command line params as one string. files : list of filepaths, optional filepaths to upload. - sleep_duration : int, optional + sleep_duration : int, optional [=2] number of seconds between 2 job_status queries. - verbose : bool, optional + verbose : bool, optional [=false] 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), so a dot each sleep_duration. diff --git a/tests/test_allgo.py b/tests/test_allgo.py index 182790685312ba2279611c93bf5fbeb5f2cdb97b..718f95bc33f5e63387f6a9e010af84030e7ca758 100644 --- a/tests/test_allgo.py +++ b/tests/test_allgo.py @@ -342,7 +342,7 @@ def test_job_status__user_not_exist(mock_get, client): @pytest.mark.error @patch('allgo.requests.get') -def test_job_status__error(mock_get, client): +def test_job_status__unknown_id(mock_get, client): # -- mock mock_get.return_value = Mock(status_code=404) mock_get.return_value.json.return_value = \