download_file_cached#
- ctapipe.utils.download.download_file_cached(name, cache_name='ctapipe', auth=None, env_prefix='CTAPIPE_DATA_', default_url='http://cccta-dataserver.in2p3.fr/data/', progress=False)[source]#
Downloads a file from a dataserver and caches the result locally in
$HOME/.cache/<cache_name>
. If the file is found in the cache, no new download is performed.- Parameters:
- name: str or pathlib.Path
the name of the file, relative to the data server url
- cache_name: str
What name to use for the cache directory
- env_prefix: str
Prefix for the environt variables used for overriding the URL, and providing username and password in case authentication is required.
- auth: True, None or tuple of (username, password)
Authentication data for the request. Will be passed to
requests.get
. IfTrue
, read username and password for the request from the env variablesenv_prefix + 'USER'
andenv_prefix + PASSWORD
- default_url: str
The default url from which to download
name
, can be overridden by setting the env variableenv_prefix + URL
- Returns:
- path: pathlib.Path
the full path to the downloaded data.