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:
objectHTTP 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 DELETEurl (
str) – URL, without its query stringparams (
Mapping[str,str|Sequence[str]] |None) – query string. A sequence repeats the parameter.timeout (
float|None) – seconds to wait for the server. QGIS’s own network timeout setting still applies when it is shorter.
- Raises:
ValueError – if the method is not supported
HttpTransportError – if no response was received
- Return type:
- Returns:
response, whatever its status code