qgis_deployment_toolbelt.profiles.remote_http_handler module

Handle remote HTTP repository.

Author: Julien Moura (https://github.com/guts).

class qgis_deployment_toolbelt.profiles.remote_http_handler.HttpHandler(source_repository_path_or_uri: str, source_repository_type: str = 'http')

Bases: RemoteProfilesHandlerBase

Handle remote HTTP repositories without git protocol.

It’s designed to handle thoses cases:

  • the distant repository (source) is on a webserver accessible through HTTP protocol

  • the local repository (destination) is on a local network or drive

HTTP_HEADERS = {'User-Agent': 'QGISDeploymentToolbelt/0.34.2'}
__init__(source_repository_path_or_uri: str, source_repository_type: str = 'http') None

Constructor.

Parameters:

source_repository_path_or_uri (str | Path) – path to the source repository

download(destination_local_path: Path)

Generic wrapper around the specific logic of this handler.

Parameters:

destination_local_path (Path) – path to the local folder where to download

download_files_to_local(li_files_to_download: list[str], target_folder: Path) tuple[list[tuple[str, Path]], list[tuple[str, Path]]]

Download list of files relative to remote base URL to local target folder.

Parameters:
  • li_files_to_download (list[str]) – list of files to download.

  • target_folder (Path) – local folder where to download

Returns:

(list of success download, list of failed download)

Return type:

tuple[list[tuple[str, Path]], list[tuple[str, Path]]]

tree_to_download_list(tree_array: list[Treeitem], rel_path: str = '') list
Parse tree structure and return a list of files to download with relative

paths to the base URL. It’s meant to be used as recursive funciton to iter through the tree structure.

Parameters:
  • tree_array (list[TreeItem]) – input array from tree JSON structure.

  • rel_path (str, optional) – relative path to resolve from. Defaults to “”.

Returns:

list of files paths relative to the base URL.

Return type:

list

class qgis_deployment_toolbelt.profiles.remote_http_handler.Treeitem

Bases: TypedDict

contents: list[dict] | None
name: str
type: str