transitio.TransitlandAtlas.download

transitio.TransitlandAtlas.download#

TransitlandAtlas.download(feed, directory=None, use_cache=True)#

Download an Atlas feed’s static GTFS zip with a provenance sidecar.

The Atlas static URL is a moving target with no upstream checksum. The newest cached copy of the feed is reused without a network request; use_cache=False downloads it again and, once that succeeds, replaces the cached copies. The .provenance.json sidecar records the source URL, the computed SHA-256 and the retrieval time.

Parameters:
  • feed (AtlasFeed)

  • directory (str or pathlib.Path, optional) – When given, a writable copy is written to the feed’s own digest-named subdirectory of it, as latest.zip beside its sidecar, and its path is returned. Otherwise the read-only cached file is returned.

  • use_cache (bool, default True) – Reuse the newest cached copy.

Returns:

Path of the zip.

Return type:

pathlib.Path

Raises:

DownloadError – When the feed has no static URL, or its download fails (dropped connections and transient HTTP errors are retried first) or is not a zip archive; a failed download leaves the cache unchanged.