|
4 | 4 | import os |
5 | 5 | from base64 import b64decode |
6 | 6 | from collections import UserDict |
7 | | -from os.path import expanduser, isfile |
| 7 | +from os.path import expanduser |
8 | 8 | from pathlib import Path |
9 | 9 | from typing import Any, Optional |
10 | 10 |
|
@@ -112,10 +112,10 @@ def __init__(self, **kwargs: Any) -> None: |
112 | 112 | raise ConfigurationError("More than one HDX configuration given!") |
113 | 113 | else: |
114 | 114 | 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(): |
119 | 119 | logger.info( |
120 | 120 | f"No HDX configuration parameter. Using default configuration file: {hdx_config_yaml}." |
121 | 121 | ) |
@@ -365,7 +365,7 @@ def create_session_user_agent( |
365 | 365 | cls, |
366 | 366 | session: requests.Session = None, |
367 | 367 | user_agent: str | None = None, |
368 | | - user_agent_config_yaml: str | None = None, |
| 368 | + user_agent_config_yaml: Path | str | None = None, |
369 | 369 | user_agent_lookup: str | None = None, |
370 | 370 | use_env: bool = False, |
371 | 371 | **kwargs: Any, |
|
0 commit comments