Skip to content

Commit

Permalink
Merge pull request #24 from GermanoGuerrini/master
Browse files Browse the repository at this point in the history
Removed URL parameter from .hdarc file
  • Loading branch information
ricardo-correa authored Apr 12, 2024
2 parents e5b942c + e14215f commit 939e42b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Upload Python Package
on:

push: {}

pull_request: {}

release:
Expand All @@ -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
Expand All @@ -38,7 +38,7 @@ jobs:
needs: quality

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v2
with:
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

Version 2.13
-----------
* Fixed missing exception case that could lead to empty files

Version 2.12
-----------
* Removed URL reading from file .hdarc

Version 2.0
-----------
* Updated version compatible with HDA v2
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
copyright = "2023, ECMWF"
author = "ECMWF"

release = "2.11"
version = "2.11"
release = "2.13"
version = "2.13"

# -- General configuration

Expand Down
18 changes: 5 additions & 13 deletions hda/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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):
Expand Down Expand Up @@ -775,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()
Expand Down
1 change: 0 additions & 1 deletion tests/custom_config.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
url: TESTURL
user: TESTUSER
password: TESTPASSWORD
2 changes: 0 additions & 2 deletions tests/test_hda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -65,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"

Expand Down

0 comments on commit 939e42b

Please sign in to comment.