Skip to content

Commit

Permalink
Put back download progress bar (#301)
Browse files Browse the repository at this point in the history
* Put back download progress bar

* Add empty print
  • Loading branch information
annehaley authored Apr 7, 2023
1 parent ec6fa33 commit 65e74d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion swcc/swcc/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,15 @@ def download(self, folder: Union[Path, str]):
r: requests.Response = session.get(f'{self._endpoint}/{self.id}/download/')
raise_for_status(r)
data = r.json()
for path, url in data['download_paths'].items():
files = data['download_paths']
print(f'Downloading {len(files)} files...')
print_progress_bar(0, len(files))
for index, (path, url) in enumerate(files.items()):
file_item: FileType = FileType(url=url)
file_item.download(Path(folder, *path.split('/')[:-1]))
print_progress_bar(index + 1, len(files))
session.close()
print()


ProjectFileIO.update_forward_refs()

0 comments on commit 65e74d0

Please sign in to comment.