download_file#
- gwpy.io.remote.download_file( ) str[source]#
Download a file from a URL and optionally cache the result.
This function is a wrapper around
astropy.utils.data.download_filewith the following customisations:File URLs (
file://) and plain paths (without a URL scheme) are returned unmodified without being downloaded or cached.Default to
cache=Trueif theGWPY_CACHEenvironment variable is set to something ‘truthy’.If the URL looks like a Pelican URL, hand off to a dedicated Pelican download wrapper to attempt the remote access.
- Parameters:
- url
str, file-like The name of the resource to access. Can be a local path, or a
file://URL, or any remote URL supported by Astropy.- cache
bool Whether to cache the contents of remote URLs. Default is
Trueif theGWPY_CACHEenvironment variable is set to something ‘truthy’.- show_progress: `bool`, optional
Print verbose progress information to the screen.
- kwargs
All other positional and keyword arguments are passed directly to
astropy.utils.data.get_readable_fileobj.
- url
- Returns:
- load_path
str The local path that the file was downloaded to.
- load_path
See also
astropy.utils.data.download_fileFor details of the underlying downloader.
gwpy.io.pelican.open_remote_fileFor details of the Pelican-aware download wrapper.