astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- Astropy Core Package Utilities (`astropy.utils`) »
- download_file

# download_file

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

  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`)

  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.