Skip to content

Commit

Permalink
Use filename from URL instead of HTML headers
Browse files Browse the repository at this point in the history
  • Loading branch information
yannforget committed Nov 17, 2018
1 parent aaeff82 commit 7c0149f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion asarapi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _dl_url(product_id):
def _dl_file(session, url, outdir, override=False, progressbar=False):
"""Download file from URL."""
r = session.get(url, stream=True)
filename = r.headers['Content-Disposition'].split('"')[1::2][0]
filename = url.split('/')[-1]
if os.path.isfile(os.path.join(outdir, filename)) and not override:
raise FileExistsError('%s already exists. Skipping...' % filename)
length = int(r.headers['Content-Length'])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='asarapi',
version='0.5',
version='0.6',
description='Search and download ERS-1, ERS-2, and Envisat products.',
long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 7c0149f

Please sign in to comment.