fibber.download_utils module

This module contains utility functions to download files to the root dir ~/.fibber.

fibber.download_utils.check_file_md5(filename, md5)[source]

Check if the md5 of a given file is correct.

Parameters
  • filename (str) – a filename.

  • md5 (str) – expected md5 hash value.

Returns

Return True if md5 matches

Return type

(bool)

fibber.download_utils.download_file(filename, url, md5, subdir=None, untar=False, unzip=False, abs_path=None)[source]

Download file from a given url.

This downloads a file to <fibber_root_dir>/subdir. If the file already exists and the md5 matches, using the existing file.

Parameters
  • filename (str) – filename as a string.

  • url (str) – the url to download the file.

  • md5 (str) – the md5 checksum of the file.

  • subdir (str) – the subdir to save the file. Dir will be created if not exists.

  • untar (bool) – whether to untar the file.

  • unzip (bool) – whether to unzip the file.

  • abs_path (str) – a folder to download files. (ignore fibber_root_dir)