download
- download(url, path, force=True, clean_on_failure=True, backend='urllib', hexdigests=None, hexdigests_remote=None, hexdigests_strict=False, progress_bar=True, tqdm_kwargs=None, **kwargs)[source]
Download a file from a given URL.
- Parameters:
url (
str
) – URL to downloadforce (
bool
) – If false and the file already exists, will not re-download.clean_on_failure (
bool
) – If true, will delete the file on any exception raised during downloadbackend (
str
) – The downloader to use. Choose ‘urllib’ or ‘requests’hexdigests (
Optional
[Mapping
[str
,str
]]) – The expected hexdigests as (algorithm_name, expected_hex_digest) pairs.hexdigests_remote (
Optional
[Mapping
[str
,str
]]) – The expected hexdigests as (algorithm_name, url to file with expected hexdigest) pairs.hexdigests_strict (
bool
) – Set this to false to stop automatically checking for the algorithm(filename)=hash formatprogress_bar (
bool
) – Set to true to show a progress bar while downloadingtqdm_kwargs (
Optional
[Mapping
[str
,Any
]]) – Override the default arguments passed totadm.tqdm
when progress_bar is True.kwargs (
Any
) – The keyword arguments to pass tourllib.request.urlretrieve()
or to requests.get depending on the backend chosen. If using ‘requests’ backend, stream is set to True by default.
- Raises:
Exception – Thrown if an error besides a keyboard interrupt is thrown during download
KeyboardInterrupt – If a keyboard interrupt is thrown during download
UnexpectedDirectory – If a directory is given for the
path
argumentValueError – If an invalid backend is chosen
- Return type: