Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## ?.?.? - Unreleased

* Fixed binary file downloads.
* Fixed credentials cache handling.

## 3.3.0 - 2025-06-20
Expand Down
4 changes: 2 additions & 2 deletions okdata/sdk/data/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def download(self, dataset_id, version, edition, output_path, retries=0):
downloaded_files = []
for file in self.get_files(dataset_id, version, edition, retries=retries):
file_name = file["key"].split("/")[-1]
file_content_response = requests.get(file["url"])
file_content_response = requests.get(file["url"], stream=True)
file_content_response.raise_for_status()

write_file_content(file_name, output_path, file_content_response.text)
write_file_content(file_name, output_path, file_content_response.raw.read())
downloaded_files.append(f"{output_path}/{file_name}")

return {"files": downloaded_files}
2 changes: 1 addition & 1 deletion okdata/sdk/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ def write_file_content(file_name, path, content):
if not Path(path).exists():
create_dir(path)

with open(f"{path}/{file_name}", "w+") as file:
with open(f"{path}/{file_name}", "wb") as file:
file.write(content)