Skip to content

Commit

Permalink
Add response
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Aug 14, 2024
1 parent dd1076b commit 274cc58
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def download_map(dataset):
if response.ok:
files = response.json()
else:
raise ValueError(f"Failed to retrieve contents: {response.status_code}")
raise ValueError(
f"Failed to retrieve contents ({response.status_code}): \n {response.text}"
)

if not local_dir.exists():
local_dir.mkdir(parents=True)
Expand All @@ -33,7 +35,7 @@ def download_map(dataset):
file_response = requests.get(file_url)
if not file_response.ok:
rmtree(local_dir)
raise ValueError(f"Failed to download file: {file_name}")
raise ValueError(f"Failed to download file: {file_name}, \n{file_response.text}")
with open(local_dir / file_name, "wb") as f:
f.write(file_response.content)

Expand Down

0 comments on commit 274cc58

Please sign in to comment.