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) Path[source]
Download a file from a URL and place it in root.
- 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, optional) – MD5 checksum of downloaded file. If None, do not check.
max_redirect_hops (int, optional) – Maximum number of redirect hops allowed.
- Returns
Filepath to downloaded file.
- Return type
pathlib.Path
- Raises
OSError – If the download process failed.
RuntimeError – If the MD5 checksum of the downloaded file did not match the expected checksum.