From d5131be53cd0fa9d4c10e8e72a9c38e524ee3467 Mon Sep 17 00:00:00 2001 From: vinny Date: Fri, 22 Mar 2024 10:45:08 -0400 Subject: [PATCH] HARMONY-1714: Revert renaming var --- harmony/harmony.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/harmony/harmony.py b/harmony/harmony.py index 3c1da70..50227f9 100644 --- a/harmony/harmony.py +++ b/harmony/harmony.py @@ -1125,27 +1125,26 @@ def _download_file(self, url: str, directory: str = '', overwrite: bool = False) """ chunksize = int(self.config.DOWNLOAD_CHUNK_SIZE) session = self._session() - filename = self.get_filename_from_url(url) - path = filename + if directory: - path = os.path.join(directory, filename) + filename = os.path.join(directory, filename) verbose = os.getenv('VERBOSE', 'TRUE') - if not overwrite and os.path.isfile(path): + if not overwrite and os.path.isfile(filename): if verbose and verbose.upper() == 'TRUE': - print(path) - return path + print(filename) + return filename else: headers = { "Accept-Encoding": "identity" } with session.get(url, stream=True, headers=headers) as r: - with open(path, 'wb') as f: + with open(filename, 'wb') as f: shutil.copyfileobj(r.raw, f, length=chunksize) if verbose and verbose.upper() == 'TRUE': - print(path) - return path + print(filename) + return filename def download(self, url: str, directory: str = '', overwrite: bool = False) -> Future: """Downloads data and saves it to a file asynchronously.