check_download_file¶
-
sunpy.util.net.
check_download_file
(filename, remotepath, download_dir, remotename=None, replace=False)[source] [edit on github]¶ Downloads a file from a remotepath to a localpath if it isn’t there.
This function checks whether a file with name
filename
exists in the user’s local machine. If it doesn’t, it downloads the file fromremotepath
.- Parameters
filename (
str
) – Name of file.remotepath (
str
) – URL of the remote location from which filename can be downloaded.download_dir (
str
) – The files directory.remotename (
str
, optional) – Filename under which the file is stored remotely. Default is same as filename.replace (
bool
, optional) – IfTrue
, file will be downloaded whether or not file already exists locally.
Examples
>>> from sunpy.util.net import check_download_file >>> remotepath = "https://www.download_repository.com/downloads/" >>> check_download_file("filename.txt", remotepath, download_dir='.')