From c3abb9cf10ce5fa29891ed43c6c24b271aa9f4b7 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Wed, 15 Feb 2023 12:24:31 +0100 Subject: [PATCH 1/6] Documentation fixes and version bumped --- README.md | 77 +-------------------------------------- docs/source/changelog.rst | 6 ++- docs/source/conf.py | 15 +++++++- setup.py | 2 +- 4 files changed, 21 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index 2555a4d..27cd2cb 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,12 @@ # WEkEO HDA API Client + This package provides a fully compliant Python 3 client that can be used to search and download products using the Harmonized Data Access WEkEO API. HDA is a RESTful interface allowing users to search and download WEkEO datasets. Documentation about its usage can be found at https://www.wekeo.eu/. -## Requirements -- Python 3 -- requests -- tqdm - -## Install the WEkEO HDA Key - -1) If you don't have a WEkEO account, please self register at the WEkEO registration page https://www.wekeo.eu/web/guest/user-registration and go to the steps below. - -2) Copy the code below in the file `$HOME/.hdarc` in your Unix/Linux environment. Adapt the following template with the credentials of your WEkEO account: - - url: https://wekeo-broker.apps.mercator.dpi.wekeo.eu/databroker - user: [username] - password: [password] - - -## Install the WEkEO HDA client - -The WEkEO HDA client is a python based library. It provides support for both Python 2.7.x and Python 3. - -You can Install the WEkEO HDA client via the package management system pip, by running on Unix/Linux the command shown below. - - pip install hda - -This will also install the required dependencies. - - -## Use the WEkEO HDA client for data access - -Once the WEkEO HDA API client is installed, it can be used to request data from the datasets listed in the WEkEO catalogue. - -On the WEkEO portal, under DATA, each dataset search has a 'Show API request' button, it displays the json request to be used. The request can be formatted using the interactive form. The API call must follow the syntax. - -The client can be used directly into another python script as in the following example: - -```python -from hda import Client - -c = Client(debug=True) - -query = { - "datasetId": "EO:CODA:DAT:SENTINEL-3:OL_1_EFR___", - "dateRangeSelectValues": [{ - "end": "2019-07-03T14:03:00.000Z", - "name": "dtrange", - "start": "2019-07-03T13:59:00.000Z" - }], - "stringChoiceValues": [] -} -matches = c.search(query) -print(matches) -matches.download() -``` - -Note that the query must be a json valid object. Please refer to the official documentation of the HDA for instructions on how to get the list of the available parameters. - -Alternatively, it can be wrapped into a script to be executed from the command line. Please refer to the ``demos/demo.py`` file for a simple demostration. - -## Reference -There are a number of options the drives the `Client` instance: -- `url`: The HDA URL. Normally set in the `.hdarc` file, can be overwritten directly by passing a value to the client. -- `user`: The HDA user. Normally set in the `.hdarc` file, can be overwritten directly by passing a value to the client. -- `password`: The HDA password. Normally set in the `.hdarc` file, can be overwritten directly by passing a value to the client. -- `token`: Credentials can be passed directly with a valid JWT Token that will take precedence over user and password. Normally unused, as the client will require a fresh token upon any API call. -- `quiet`: Pass `True` to disable logging. Default: `False`. -- `debug`: Pass `True` to enable debug. Requires `quiet` to be `False`. Default: `False`. -- `verify`: Whether to verify for SSL certificate of the HDA or not. Normally there is no need to modify the default value. Default: `None`. -- `timeout`: The time, in seconds, before the client should stop waiting for a response. Default: `None`. -- `retry_max`: The number of retries before the client should stop trying to get a successful response. Default: 500. -- `sleep_max`: The time, in seconds, to wait between two attempts. Default: 120. -- `info_callback`: A callback function that can be attached to the `info` logging level messages. Will replace the default logging. Default: `None`. -- `warning_callback`: A callback function that can be attached to the `warning` logging level messages. Will replace the default logging. Default: `None`. -- `error_callback`: A callback function that can be attached to the `error` logging level messages. Will replace the default logging. Default: `None`. -- `debug_callback`: A callback function that can be attached to the `debug` logging level messages. Will replace the default logging. Default: `None`. -- `progress`: Whether to show or hide a progress bar. Default: `True`. +The documentation for this package can be found at: https://hda.readthedocs.io/en/latest/ ## Contribution Contribute to the development of this client by creating an account on GitHub. You can follow this guidelines for a general overview of the needed steps: https://github.com/firstcontributions/first-contributions. diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index f114aa3..905047b 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,7 +1,11 @@ Changelog ========= -Version 0.4.0 +Version 1.1.1 +------------- +* Minor documentation fixes + +Version 1.1.0 ------------- * Refactored client configuration * Logging system is now left to the developer diff --git a/docs/source/conf.py b/docs/source/conf.py index 6a9a875..256d396 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,13 +1,22 @@ # Configuration file for the Sphinx documentation builder. +import sys +import os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('../..')) + # -- Project information project = "WEkEO HDA API Client" copyright = "2023, ECMWF" author = "ECMWF" -release = "0.4.0" -version = "0.4.0" +release = "1.1.1" +version = "1.1.1" # -- General configuration @@ -33,3 +42,5 @@ # -- Options for EPUB output epub_show_urls = "footnote" + +autodoc_mock_imports = ['tqdm', 'requests'] diff --git a/setup.py b/setup.py index a30393c..2b2d768 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def read(fname): return io.open(file_path, encoding="utf-8").read() -version = "0.3.7" +version = "1.1.1" setuptools.setup( From 4311b0f09e97cdeff1d0638ff1807d92d56cd0f8 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Wed, 15 Feb 2023 14:41:14 +0100 Subject: [PATCH 2/6] Updated version --- docs/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 256d396..2267adc 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,8 +15,8 @@ copyright = "2023, ECMWF" author = "ECMWF" -release = "1.1.1" -version = "1.1.1" +release = "1.13" +version = "1.13" # -- General configuration From 34133bdcd19ddfa4ab1ad73e9ca4819f8f7506b5 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Wed, 15 Feb 2023 14:45:36 +0100 Subject: [PATCH 3/6] Final doc fixes --- docs/source/api.rst | 2 +- hda/api.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/api.rst b/docs/source/api.rst index 61523e5..85a02f3 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -3,7 +3,7 @@ API .. automodule:: hda.api -.. autoattribute:: hda.pi.BROKER_URL +.. autoattribute:: hda.api.BROKER_URL .. autoclass:: RequestRunner :members: diff --git a/hda/api.py b/hda/api.py index 75026a0..973cf12 100644 --- a/hda/api.py +++ b/hda/api.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/setup.py b/setup.py index c5d725c..384c13c 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def read(fname): return io.open(file_path, encoding="utf-8").read() -version = "1.3" +version = "1.13" setuptools.setup( name="hda", From 22f8172953c1825205d642e707a93ac25ed7be86 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Wed, 15 Feb 2023 15:08:33 +0100 Subject: [PATCH 4/6] Changed sample dataset --- demos/sentinel.json | 2 +- docs/source/quickstart.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demos/sentinel.json b/demos/sentinel.json index 35aa330..451a4b6 100644 --- a/demos/sentinel.json +++ b/demos/sentinel.json @@ -1,5 +1,5 @@ { - "datasetId": "EO:CODA:DAT:SENTINEL-3:OL_1_EFR___", + "datasetId": "EO:EUM:DAT:SENTINEL-3:OL_1_EFR___", "dateRangeSelectValues": [{ "end": "2019-07-03T14:03:00.000Z", "name": "dtrange", diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 92e89ba..b358675 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -17,7 +17,7 @@ The client can be used directly into another python script as in the following e c = Client() query = { - "datasetId": "EO:CODA:DAT:SENTINEL-3:OL_1_EFR___", + "datasetId": "EO:EUM:DAT:SENTINEL-3:OL_1_EFR___", "dateRangeSelectValues": [{ "end": "2019-07-03T14:03:00.000Z", "name": "dtrange", From 82c5303b74c759d880475143cfebdaff025e877d Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Wed, 15 Feb 2023 16:12:03 +0100 Subject: [PATCH 5/6] Black formatting --- docs/source/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 2267adc..9635a2e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -6,8 +6,8 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) -sys.path.insert(0, os.path.abspath('../..')) +# sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath("../..")) # -- Project information @@ -43,4 +43,4 @@ # -- Options for EPUB output epub_show_urls = "footnote" -autodoc_mock_imports = ['tqdm', 'requests'] +autodoc_mock_imports = ["tqdm", "requests"] From 4eee2f50b1ba513cb47ac2cb670f813d35c3065d Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Wed, 15 Feb 2023 16:16:05 +0100 Subject: [PATCH 6/6] Fixed isort --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 9635a2e..f86c8e7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,7 +1,7 @@ # Configuration file for the Sphinx documentation builder. -import sys import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the