lsru.utils.url_retrieve

lsru.utils.url_retrieve(url, filename, overwrite=False, check_complete=True)[source]

Generic file download function

Similar to url_retrieve from standard library with additional checks for already existing files and incomplete downloads

Parameters:
  • url (str) – Url pointing to file to retrieve
  • filename (str) – Local file name under which the downloaded content is written
  • overwrite (bool) – Force overwriting local file even when it already exists? Defaults to False
  • check_complete (bool) – When local file exists and overwrite is set to False, check whether local and remote file sizes match? File is re-downloaded when sizes are different. Only makes sense if overwrite is set to False. Defaults to True
Returns:

The filename

Return type:

str