bw2io.download_utils#

Functions#

download_with_progressbar(url[, filename, dirpath, ...])

Download file from URL and show progress bar.

get_filename(response)

Get filename from response headers or URL.

Module Contents#

bw2io.download_utils.download_with_progressbar(url, filename=None, dirpath=None, chunk_size=4096 * 8)[source]#

Download file from URL and show progress bar.

Parameters:
  • url (str) – URL to download from.

  • filename (str, optional) – Filename to save to. If not given, will be determined from URL.

  • dirpath (str, optional) – Directory to save to. If not given, will be current working directory.

  • chunk_size (int, optional) – Chunk size to use when downloading.

Returns:

Path to downloaded file.

Return type:

pathlib.Path

bw2io.download_utils.get_filename(response)[source]#

Get filename from response headers or URL.

Parameters:

response (requests.Response)

Returns:

Filename

Return type:

str