opendataval.dataloader.cache#

opendataval.dataloader.cache(url: str, cache_dir: Path, file_name: str | None = None, force_download: bool = False) Path#

Download a file if it it is not present and returns the filepath.

Parameters#

urlstr

URL of the file to be downloaded

cache_dirstr

Directory to cache downloaded files

file_namestr, optional

File name within the cache directory of the downloaded file, by default None

force_downloadbool, optional

Forces a download regardless if file is present, by default False

Returns#

str

File path to the downloaded file

Raises#

HTTPError

HTTP error occurred during downloading the dataset.