qgis_deployment_toolbelt.utils.file_downloader module#

qgis_deployment_toolbelt.utils.file_downloader.download_remote_file_to_local(remote_url_to_download: str, local_file_path: Path, user_agent: str = 'QGISDeploymentToolbelt/0.31.1', content_type: str | None = None, chunk_size: int = 8192, timeout=(800, 800)) Path#

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.

Parameters:
  • remote_url_to_download (str) – remote URL of the search index

  • local_file_path (Path) – local path to the index file

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

  • content_type (str | None, optional) – HTTP content-type. Defaults to None.

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

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

Returns:

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

Return type:

Path