Skip to content

Commit

Permalink
Rename internal api variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcth committed May 30, 2024
1 parent ccf97ad commit da4d6b6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lantmateriet/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand All @@ -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.
Expand All @@ -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)

Expand Down

0 comments on commit da4d6b6

Please sign in to comment.