Skip to content

Commit

Permalink
Skip process only for gdrive files by breaking early
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Jan 25, 2024
1 parent 7c5c1a9 commit d3e769f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gdown/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ def download(
while True:
res = sess.get(url, stream=True, verify=verify)

if not (gdrive_file_id and is_gdrive_download_link):
break

if url == url_origin and res.status_code == 500:
# The file could be Google Docs or Spreadsheets.
url = "https://drive.google.com/open?id={id}".format(id=gdrive_file_id)
Expand Down Expand Up @@ -213,8 +216,6 @@ def download(
if "Content-Disposition" in res.headers:
# This is the file
break
if not (gdrive_file_id and is_gdrive_download_link):
break

# Need to redirect with confirmation
try:
Expand Down

0 comments on commit d3e769f

Please sign in to comment.