check_download_file, remotepath, download_dir, remotename=None, replace=False)[source] [edit on github]

Downloads a file from remotepath to localpath if it isn’t there.

This function checks whether a file with name filename exists in the location, localpath, on the user’s local machine. If it doesn’t, it downloads the file from remotepath.

  • filename (string) – Name of file.
  • remotepath (string) – URL of the remote location from which filename can be downloaded.
  • download_dir (string) – The files directory.
  • remotename ((optional) string) – filename under which the file is stored remotely. Default is same as filename.
  • replace ((optional) bool) – If True, file will be downloaded whether or not file already exists locally.


>>> from import check_download_file
>>> remotepath = ""
>>> check_download_file("filename.txt", remotepath, download_dir='.')   # doctest: +SKIP