From 2f52e8593e286552bde8650e04f5ecaf0165848b Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Wed, 25 Sep 2024 19:56:15 +0100 Subject: [PATCH] Update files/files.py Co-authored-by: codiumai-pr-agent-pro[bot] <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com> --- files/files.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/files.py b/files/files.py index 0fed447..fb0ca5c 100644 --- a/files/files.py +++ b/files/files.py @@ -98,7 +98,8 @@ def download_files_from_ftp(file_list_json, output_folder): download_url = file['publicFileLocations'][1]['value'] logging.debug('ftp_filepath:' + download_url) new_file_path = Files.get_output_file_name(download_url, file, output_folder) - from tqdm import tqdm + with urllib.request.urlopen(download_url) as response, open(new_file_path, 'wb') as out_file: + shutil.copyfileobj(response, out_file) with tqdm(unit='B', unit_scale=True, unit_divisor=1024, miniters=1, desc=file['accession']) as progress_bar: urllib.request.urlretrieve(download_url, new_file_path, reporthook=lambda blocks, block_size, total_size: progress_bar.update(block_size))