transitio.MobilityDatabase.download#
- MobilityDatabase.download(dataset, directory=None, use_cache=True)#
Download a dataset zip with checksum verification and caching.
A dataset is a fixed version, so a cached copy holding it (its bytes matching the catalogued hash, when the catalogue gives one) is reused without a network request;
use_cache=Falsedownloads it again. Identical bytes catalogued as several datasets are stored once.- Parameters:
dataset (Dataset)
directory (str or pathlib.Path, optional) – When given, a writable copy is written to
<directory>/<dataset id>.zipbeside a.provenance.jsonsidecar recording feed and dataset IDs, source URL, checksum, service dates and retrieval time, and its path is returned. Otherwise the read-only cached file is returned; its sidecar describes the first dataset stored with these bytes.use_cache (bool, default True) – Reuse a cached copy of the dataset.
- Returns:
Path of the zip.
- Return type:
pathlib.Path
- Raises:
DownloadError – When the dataset has no hosted URL, its download fails (dropped connections and transient HTTP errors are retried first), its checksum does not match, or it is not a zip archive.