download_file¶
-
astropy.utils.data.
download_file
(remote_url, cache=False, show_progress=True, timeout=None)[source] [edit on github]¶ Accepts a URL, downloads and optionally caches the result returning the filename, with a name determined by the file’s MD5 hash. If
cache=True
and the file is present in the cache, just returns the filename.Parameters: - remote_url : str
The URL of the file to download
- cache : bool, optional
Whether to use the cache
- show_progress : bool, optional
Whether to display a progress bar during the download (default is
True
). Regardless of this setting, the progress bar is only displayed when outputting to a terminal.- timeout : float, optional
The timeout, in seconds. Otherwise, use
astropy.utils.data.Conf.remote_timeout
.
Returns: - local_path : str
Returns the local path that the file was download to.
Raises: - urllib2.URLError, urllib.error.URLError
Whenever there’s a problem getting the remote file.