Skip to content

Commit

Permalink
Fixed missing config dict error (in remote CI/CD) by mocking it, move…
Browse files Browse the repository at this point in the history
…d load_config into function, #45
  • Loading branch information
MarcoHuebner committed Sep 4, 2022
1 parent 2f7cdef commit 1fa5e0f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/pygenesis/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ def clean_cache(file: Optional[str] = None) -> None:
cache_dir = Path(config["DATA"]["cache_dir"])
except KeyError as e:
logger.critical(
"Cache dir does not exist! Please make sure init_config() was run properly. \
Path: %s, Error: %s",
cache_dir,
"Cache dir does not exist! Please make sure init_config() was run properly. Error: %s",
e,
)

Expand Down
2 changes: 1 addition & 1 deletion src/pygenesis/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_data(
if method == "tablefile":
params["format"] = "ffcsv"

params |= kwargs
params.update(kwargs)

response = get_response_from_endpoint("data", method, params)
data = response.text
Expand Down
10 changes: 6 additions & 4 deletions src/pygenesis/http_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ def get_response_from_endpoint(
config = load_config()
url = f"{config['GENESIS API']['base_url']}{endpoint}/{method}"

params |= {
"username": config["GENESIS API"]["username"],
"password": config["GENESIS API"]["password"],
}
params.update(
{
"username": config["GENESIS API"]["username"],
"password": config["GENESIS API"]["password"],
}
)

response = requests.get(url, params=params)

Expand Down

0 comments on commit 1fa5e0f

Please sign in to comment.