Skip to content

Commit 40ab8b4

Browse files
committed
Make path aware
1 parent bfa7345 commit 40ab8b4

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies = [
3838
"defopt>=7.0.0",
3939
"email_validator",
4040
"hdx-python-country>=4.0.1",
41-
"hdx-python-utilities>=4.0.1",
41+
"hdx-python-utilities>=4.0.2",
4242
"libhxl>=5.2.2",
4343
"makefun",
4444
"quantulum3",

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ frictionless==5.18.1
3636
# via hdx-python-utilities
3737
hdx-python-country==4.0.1
3838
# via hdx-python-api (pyproject.toml)
39-
hdx-python-utilities==4.0.1
39+
hdx-python-utilities==4.0.2
4040
# via
4141
# hdx-python-api (pyproject.toml)
4242
# hdx-python-country

src/hdx/api/configuration.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
from base64 import b64decode
66
from collections import UserDict
7-
from os.path import expanduser, isfile
7+
from os.path import expanduser
88
from pathlib import Path
99
from typing import Any, Optional
1010

@@ -112,10 +112,10 @@ def __init__(self, **kwargs: Any) -> None:
112112
raise ConfigurationError("More than one HDX configuration given!")
113113
else:
114114
if not hdx_config_yaml:
115-
hdx_config_yaml = Configuration.default_hdx_config_yaml
116-
if not isfile(hdx_config_yaml):
117-
hdx_config_yaml = hdx_config_yaml.replace(".yaml", ".yml")
118-
if isfile(hdx_config_yaml):
115+
hdx_config_yaml = Path(Configuration.default_hdx_config_yaml)
116+
if not hdx_config_yaml.is_file():
117+
hdx_config_yaml = hdx_config_yaml.with_suffix(".yml")
118+
if hdx_config_yaml.is_file():
119119
logger.info(
120120
f"No HDX configuration parameter. Using default configuration file: {hdx_config_yaml}."
121121
)
@@ -365,7 +365,7 @@ def create_session_user_agent(
365365
cls,
366366
session: requests.Session = None,
367367
user_agent: str | None = None,
368-
user_agent_config_yaml: str | None = None,
368+
user_agent_config_yaml: Path | str | None = None,
369369
user_agent_lookup: str | None = None,
370370
use_env: bool = False,
371371
**kwargs: Any,

0 commit comments

Comments
 (0)