geotribu_cli.utils.file_downloader module

geotribu_cli.utils.file_downloader.download_remote_file_to_local(remote_url_to_download, local_file_path, expiration_rotating_hours=24, user_agent='GeotribuToolbelt/0.33.0', content_type=None, chunk_size=8192, timeout=(800, 800))

Check if the local index file exists. If not, download the search index from remote URL. If it does exist, check if it has been modified.

Paramètres:
  • remote_url_to_download (str) – remote URL of the file to download

  • local_file_path (Path) – local path to the file

  • expiration_rotating_hours (int, optional) – number in hours to consider the local file outdated. Defaults to 24.

  • user_agent (str, optional) – user agent to use to perform the request. Defaults to f »{__title_clean__}/{__version__} ».

  • content_type (str) – HTTP content-type.

  • chunk_size (int) – size of each chunk to read and write in bytes. Defaults to 8192.

  • timeout (tuple, optional) – custom timeout (request, response). Defaults to (800, 800).

Renvoie:

path to the local file (should be the same as local_file_path)

Type renvoyé:

Path