Skip to content

Commit

Permalink
HARMONY-1714: Revert renaming var
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnyinverso committed Mar 22, 2024
1 parent 51e95c9 commit d5131be
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions harmony/harmony.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d5131be

Please sign in to comment.