From da4d6b6c68c4c233ccf708bdddc221ff3a08ee94 Mon Sep 17 00:00:00 2001 From: Mladen Gibanica <11275336+mgcth@users.noreply.github.com> Date: Thu, 30 May 2024 22:45:53 +0200 Subject: [PATCH] Rename internal api variable --- src/lantmateriet/api.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lantmateriet/api.py b/src/lantmateriet/api.py index e582e43..9405263 100644 --- a/src/lantmateriet/api.py +++ b/src/lantmateriet/api.py @@ -62,8 +62,10 @@ def __init__(self, order_id: str, save_path: str): Path(save_path).mkdir(exist_ok=True) self._order_enpoint = json.loads(get_request(order_url).content) - download = json.loads(get_request(download_url).content) - self._download_enpoint = {item["title"]: item for item in download} + available_files = json.loads(get_request(download_url).content) + self._available_files_enpoint = { + item["title"]: item for item in available_files + } @property def order(self) -> dict[str, str]: @@ -73,7 +75,7 @@ def order(self) -> dict[str, str]: @property def available_files(self) -> list[str]: """Get available files.""" - return list(self._download_enpoint.keys()) + return list(self._available_files_enpoint.keys()) def download(self, title: str) -> None: """Download file by title. @@ -83,7 +85,7 @@ def download(self, title: str) -> None: """ logger.info(f"Started downloading {title}") - url = self._download_enpoint[title]["href"] + url = self._available_files_enpoint[title]["href"] response = get_request(url) buffer = self._download(response)