pds4_tools.utils.data_access module¶
Functions¶
|
Download a remote file from a URL. |
|
Check if a string is a supported URL. |
|
Clears the data file cache by deleting the local file(s). |
Details¶
- download_file(url, force=False, block_size=65536, timeout=10)[source]¶
Download a remote file from a URL.
Files are downloaded into a local cache location, and deleted upon Python interpreter exit. Uses
is_supported_url
to determine supported URL schemes.- Parameters
- urlstr or unicode
A supported remote URL to download.
- forcebool, optional
Re-download file even if the URL is already cached. Defaults to None.
- block_sizeint, optional
The block-size of each remote read command, in bytes. Defaults to 64 KB.
- timeoutint, optional
A timeout in seconds for blocking operations like the connection attempt. Defaults to 10 seconds.
- Returns
- str or unicode
Path to the local (cache) location of the downloaded file.
Notes
The cache location can be customized via the
PDS4TOOLSCACHEDIR
environment variable. Partially adapted fromastropy.utils.data.download_file
.