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) None[source]

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, optional) – Target filename of saved file.

  • extract_dirpath (Path, optional) – Path to directory where archive files will be extracted to.

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

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

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

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.