diff --git a/synapseclient/client.py b/synapseclient/client.py index 376b475f5..5de077586 100644 --- a/synapseclient/client.py +++ b/synapseclient/client.py @@ -2731,6 +2731,7 @@ def _download_from_URL( actual_md5 = None redirect_count = 0 delete_on_md5_mismatch = True + self.logger.debug(f"Downloading from {url} to {destination}") while redirect_count < REDIRECT_LIMIT: redirect_count += 1 scheme = urllib_urlparse.urlparse(url).scheme @@ -2747,7 +2748,24 @@ def _download_from_URL( ) break elif scheme == "ftp": - urllib_request.urlretrieve(url, destination) + transfer_start_time = time.time() + + def _ftp_report_hook( + block_number: int, read_size: int, total_size: int + ) -> None: + show_progress = not self.silent + if show_progress: + self._print_transfer_progress( + transferred=block_number * read_size, + toBeTransferred=total_size, + prefix="Downloading ", + postfix=os.path.basename(destination), + dt=time.time() - transfer_start_time, + ) + + urllib_request.urlretrieve( + url=url, filename=destination, reporthook=_ftp_report_hook + ) break elif scheme == "http" or scheme == "https": # if a partial download exists with the temporary name,