Skip to main content
`Ctrl`+`K`

# is_url_in_cache

astropy.utils.data.is_url_in_cache(url_key, pkgname='astropy', *, on_missing='warn')

  Check if a download for `url_key` is in the cache.

  The provided `url_key` will be the name used in the cache. The contents may have been downloaded from this URL or from a mirror or they may have been provided by the user. See `download_file` for details.

  Parameters:
    url_key `python:str`

      The URL retrieved

    pkgname `str`, optional

      The package name to use to locate the download cache. i.e. for `pkgname='astropy'` the default cache location is `~/.cache/astropy`.

    on_missing‘ignore’, ‘warn’, or ‘error’

      What to do if the cache directory doesn’t exist. Default: ‘warn’

      Added in version 8.0.

  Returns:
    in_cache bool

      `True` if a download for `url_key` is in the cache, `False` if not or if the cache does not exist at all.

  See also

  `cache_contents`

    obtain a dictionary listing everything in the cache