From f5e48cdc42f7bc10ec1140883fca2a747ee78bcb Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Wed, 13 Mar 2024 17:47:49 +0100 Subject: [PATCH 1/6] Removed reading url parameter from hdarc file --- hda/api.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/hda/api.py b/hda/api.py index 30f194a..f9b1b05 100644 --- a/hda/api.py +++ b/hda/api.py @@ -317,14 +317,12 @@ def __init__( url=os.environ.get("HDA_URL"), user=os.environ.get("HDA_USER"), password=os.environ.get("HDA_PASSWORD"), - verify=None, + verify=True, path=None, ): credentials = { - "url": url or BROKER_URL, "user": None, - "password": None, - "verify": True, + "password": None } dotrc = path or os.environ.get("HDA_RC", os.path.expanduser("~/.hdarc")) @@ -336,25 +334,19 @@ def __init__( if config.get(key): credentials[key] = config.get(key) - if url is not None: - credentials["url"] = url - if user is not None: credentials["user"] = user if password is not None: credentials["password"] = password - if verify is not None: - credentials["verify"] = verify - if credentials["user"] is None or credentials["password"] is None: raise ConfigurationError("Missing or incomplete configuration") - self.url = credentials["url"] + self.url = url or BROKER_URL self.user = credentials["user"] self.password = credentials["password"] - self.verify = credentials["verify"] + self.verify = verify class Client(object): From 59c52b6ab7ae3471e12a021e0ad2cdfeef71823c Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Wed, 13 Mar 2024 17:50:28 +0100 Subject: [PATCH 2/6] Bumped version 2.12 --- docs/source/changelog.rst | 4 ++++ docs/source/conf.py | 4 ++-- setup.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 3b15919..496f5e6 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,6 +1,10 @@ Changelog ========= +Version 2.12 +----------- +* Removed URL reading from file .hdarc + Version 2.0 ----------- * Updated version compatible with HDA v2 diff --git a/docs/source/conf.py b/docs/source/conf.py index d2f13aa..7fa6be7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,8 +15,8 @@ copyright = "2023, ECMWF" author = "ECMWF" -release = "2.11" -version = "2.11" +release = "2.12" +version = "2.12" # -- General configuration diff --git a/setup.py b/setup.py index 1207d5a..5fae67d 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def read(fname): return io.open(file_path, encoding="utf-8").read() -version = "2.11" +version = "2.12" setuptools.setup( name="hda", From ff19b59bab0fa1c309480a75a1e60b7cf3f3fc35 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Thu, 14 Mar 2024 08:54:32 +0100 Subject: [PATCH 3/6] Fixed test --- tests/custom_config.txt | 1 - tests/test_hda.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/custom_config.txt b/tests/custom_config.txt index 78d27c9..dec5de8 100644 --- a/tests/custom_config.txt +++ b/tests/custom_config.txt @@ -1,3 +1,2 @@ -url: TESTURL user: TESTUSER password: TESTPASSWORD diff --git a/tests/test_hda.py b/tests/test_hda.py index 8acc3b7..c63a514 100644 --- a/tests/test_hda.py +++ b/tests/test_hda.py @@ -56,7 +56,6 @@ def test_custom_password_config(): def test_custom_path_config(): config = Configuration(user=None, password=None, path=CUSTOM_HDRRC) c = Client(config=config) - assert c.config.url == "TESTURL" assert c.config.user == "TESTUSER" assert c.config.password == "TESTPASSWORD" From 3982a50595b6d01f8d2540b8a178ed94bf5d16e6 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Thu, 14 Mar 2024 09:08:47 +0100 Subject: [PATCH 4/6] Updated tests and fixed deprecation warning in github workflow --- .github/workflows/python-publish.yml | 8 ++++---- tests/test_hda.py | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index adbbc00..548f631 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -6,7 +6,7 @@ name: Upload Python Package on: push: {} - + pull_request: {} release: @@ -17,7 +17,7 @@ jobs: name: Code QA runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: pip install black flake8 isort - run: black --version - run: isort --version @@ -38,7 +38,7 @@ jobs: needs: quality steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions/setup-python@v2 with: @@ -63,7 +63,7 @@ jobs: needs: checks steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v2 diff --git a/tests/test_hda.py b/tests/test_hda.py index c63a514..0ac8d65 100644 --- a/tests/test_hda.py +++ b/tests/test_hda.py @@ -64,7 +64,6 @@ def test_custom_path_config(): def test_mixed_config(): config = Configuration(user="TU", password="TP", path=CUSTOM_HDRRC) c = Client(config=config) - assert c.config.url == "TESTURL" assert c.config.user == "TU" assert c.config.password == "TP" From 47fcb27a09d0a49fad31d23b76284fdb76acf094 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Thu, 11 Apr 2024 15:17:26 +0200 Subject: [PATCH 5/6] Fixed missing exception case that could lead to empty files --- hda/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hda/api.py b/hda/api.py index f9b1b05..5567d37 100644 --- a/hda/api.py +++ b/hda/api.py @@ -767,7 +767,7 @@ def stream(self, download_id, size, download_dir): total += len(chunk) pbar.update(len(chunk)) - except requests.exceptions.ConnectionError as e: + except requests.exceptions.RequestException as e: logger.error("Download interrupted: %s" % (e,)) finally: r.close() From e14215f18e3a0fc2f139920057e6b2ab1ee9f041 Mon Sep 17 00:00:00 2001 From: Germano Guerrini Date: Thu, 11 Apr 2024 15:19:16 +0200 Subject: [PATCH 6/6] Version 2.13 --- docs/source/changelog.rst | 4 ++++ docs/source/conf.py | 4 ++-- setup.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 496f5e6..c4150a3 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,6 +1,10 @@ Changelog ========= +Version 2.13 +----------- +* Fixed missing exception case that could lead to empty files + Version 2.12 ----------- * Removed URL reading from file .hdarc diff --git a/docs/source/conf.py b/docs/source/conf.py index 7fa6be7..7782a74 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,8 +15,8 @@ copyright = "2023, ECMWF" author = "ECMWF" -release = "2.12" -version = "2.12" +release = "2.13" +version = "2.13" # -- General configuration diff --git a/setup.py b/setup.py index 5fae67d..23b2be6 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def read(fname): return io.open(file_path, encoding="utf-8").read() -version = "2.12" +version = "2.13" setuptools.setup( name="hda",