dicogis.utils.http.backend_qgis module

HTTP client based on the network stack of QGIS.

Applies what is configured in QGIS (proxy, SSL exceptions, authentication manager) and can run from any thread, typically in a QgsTask. QGIS is imported at the last moment: this module must stay importable without it.

class dicogis.utils.http.backend_qgis.QgisHttpClient(authcfg=None, feedback=None)

Bases: object

HTTP client based on QgsBlockingNetworkRequest.

__init__(authcfg=None, feedback=None)

Initialize the client.

Parameters:
  • authcfg (str | None) – identifier of a configuration of the QGIS authentication manager

  • feedback (QgsFeedback | None) – interrupts the running request when canceled

request(method, url, *, params=None, headers=None, data=None, timeout=None)

Send a request and wait for its response. See HttpClient.request().

Parameters:
  • method (str) – HTTP method: GET, POST, PUT or DELETE

  • url (str) – URL, without its query string

  • params (Mapping[str, str | Sequence[str]] | None) – query string. A sequence repeats the parameter.

  • headers (Mapping[str, str] | None) – request headers

  • data (bytes | None) – body

  • timeout (float | None) – seconds to wait for the server. QGIS’s own network timeout setting still applies when it is shorter.

Raises:
Return type:

HttpResponse

Returns:

response, whatever its status code