download_file

astropy.utils.data.download_file(remote_url, cache=False, show_progress=True, timeout=None)[source]

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_urlstr

The URL of the file to download

cachebool, optional

Whether to use the cache

show_progressbool, 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.

timeoutfloat, optional

The timeout, in seconds. Otherwise, use astropy.utils.data.Conf.remote_timeout.

Returns
local_pathstr

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.