Download multiple files to the given directory.
(urls: Iterable[str], dest_dir: str)
| 61 | |
| 62 | |
| 63 | def download(urls: Iterable[str], dest_dir: str): |
| 64 | class="st">""class="st">"Download multiple files to the given directory."class="st">"" |
| 65 | |
| 66 | with progress: |
| 67 | with ThreadPoolExecutor(max_workers=4) as pool: |
| 68 | for url in urls: |
| 69 | filename = url.split(class="st">"/")[-1] |
| 70 | dest_path = os.path.join(dest_dir, filename) |
| 71 | task_id = progress.add_task(class="st">"download", filename=filename, start=False) |
| 72 | pool.submit(copy_url, task_id, url, dest_path) |
| 73 | |
| 74 | |
| 75 | if __name__ == class="st">"__main__": |
no test coverage detected