pymovements.utils.downloads.download_file#

pymovements.utils.downloads.download_file(url: str, dirpath: Path, filename: str, md5: str | None = None, max_redirect_hops: int = 3, verbose: bool = True) Path[source]#

Download a file from a URL and place it in root.

Deprecated since version v0.21.1: Please use download() instead. This function will be removed in v0.26.0.

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

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

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

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

  • max_redirect_hops (int) – Maximum number of redirect hops allowed. (default: 3)

  • verbose (bool) – If True, show progress bar and print info messages on downloading file. (default: True)

Returns:

Filepath to downloaded file.

Return type:

Path

Raises:
  • OSError – If the download process failed.

  • RuntimeError – If the MD5 checksum of the downloaded file did not match the expected checksum.

  • .. deprecated: – v0.21.1: Please use Dataset.download() instead. This function will be removed in v0.26.0.