Skip to content

Commit

Permalink
Testing reusing token to minimize sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
HertugHelms committed Jul 28, 2023
1 parent 70edb5a commit 00848ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions creodias_finder/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _get_token(username, password):
raise RuntimeError(f"Unable to get token. Response was {response}")


def download(uid, username, password, outfile, show_progress=True):
def download(uid, username, password, outfile, show_progress=True, token=None):
"""Download a file from CreoDIAS to the given location
Parameters
Expand All @@ -38,7 +38,7 @@ def download(uid, username, password, outfile, show_progress=True):
outfile:
Path where incomplete downloads are stored
"""
token = _get_token(username, password)
token = token if token else _get_token(username, password)
url = f"{DOWNLOAD_URL}/{uid}?token={token}"
_download_raw_data(url, outfile, show_progress)

Expand Down

0 comments on commit 00848ef

Please sign in to comment.