traveler.core.downloading.download_asset#
- traveler.core.downloading.download_asset(url, target_path, sha256=None, link=True, base_path=None, unpack=None)[source]#
Download assets (extra files) associated with examples.
- Parameters:
url (str) – The URL to download.
target_path (str) – The location where the asset should be made available. The raw asset file is not necessarily stored here, as it may be stored in a cache directory and symlinked here instead (see link).
sha256 (str, optional) – Checksum for the file. If there is already a cached file and the checksum matches, it is not re-downloaded and the cached version is used. Otherwise, the file is downloaded, and if the downloaded file’s checksum does not match, an error is raised.
link (bool, default True) – Download the raw asset to a cache location, and then symlink to the desired target_path location. Note symlinks may not work on Windows so the file will still be stored in the cache but it will be copied instead of linked.
base_path (str, optional) – Give the base directory for the example.
unpack (str, optional) – If the asset is an archive file (.zip, .tar.gz, or .tar.zst), it will be decompressed into this location.