Skip to content

Commit

Permalink
Refactor _get_filename_from_response function
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Feb 1, 2024
1 parent 298f680 commit cb1eff4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gdown/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def get_url_from_gdrive_confirmation(contents):
return url


def _get_filename_from_response(res):
content_disposition = urllib.parse.unquote(res.headers["Content-Disposition"])
def _get_filename_from_response(response):
content_disposition = urllib.parse.unquote(response.headers["Content-Disposition"])

m = re.search(r"filename\*=UTF-8''(.*)", content_disposition)
if m:
Expand Down Expand Up @@ -257,7 +257,7 @@ def download(

filename_from_url = None
if gdrive_file_id and is_gdrive_download_link:
filename_from_url = _get_filename_from_response(res)
filename_from_url = _get_filename_from_response(response=res)
if filename_from_url is None:
filename_from_url = osp.basename(url)

Expand Down

0 comments on commit cb1eff4

Please sign in to comment.