pymovements.utils.downloads.download_and_extract_archive#

pymovements.utils.downloads.download_and_extract_archive(url: str, download_dirpath: Path, download_filename: str, extract_dirpath: Path | None = None, md5: str | None = None, recursive: bool = True, remove_finished: bool = False, remove_top_level: bool = True, verbose: int = 1) None#

Download and extract archive file.

Parameters:
  • url (str) – URL of archive file to be downloaded.

  • download_dirpath (Path) – Path to directory where file will be saved to.

  • download_filename (str) – Target filename of saved file.

  • extract_dirpath (Path | None) – Path to directory where archive files will be extracted to. (default: None)

  • md5 (str | None) – MD5 checksum of downloaded file. If None, do not check. (default: None)

  • recursive (bool) – Recursively extract archives which are included in extracted archive. (default: True)

  • remove_finished (bool) – Remove downloaded file after successful extraction or decompression. (default: False)

  • remove_top_level (bool) – If True, remove the top-level directory if it has only one child. (default: True)

  • verbose (int) – Verbosity levels: (1) Show download progress bar and print info messages on downloading and extracting archive files without printing messages for recursive archive extraction. (2) Print additional messages for each recursive archive extract. (default: 1)

Raises:

RuntimeError – If the downloaded file has no suffix or suffix is not supported, or in case of a specified MD5 checksum which doesn’t match the checksum of the downloaded file.