Class: QgsHttpHeaders¶
Implements simple HTTP header management.
Added in version 3.24.
Methods
Returns the headers as a variant map |
|
insert a key with the specific value |
|
Returns the list of all HTTP header keys. |
|
Returns a cleansed key |
|
Loads headers from the element |
|
Loads headers from the map |
|
Loads headers from the settings |
|
Loads headers from the uri |
|
Returns key/value pairs as strings separated by space |
|
Updates a DOM element by adding all the HTTP headers |
|
Updates a map by adding all the HTTP headers |
|
Updates a request by adding all the HTTP headers |
|
Updates the settings by adding all the http headers in the path "key/PATH_PREFIX/" |
|
Updates an uri by adding all the HTTP headers |
- class qgis.core.QgsHttpHeaders[source]¶
Bases:
object
- __init__(headers: Dict[str, Any])
Constructor from map
- Parameters:
headers (Dict[str, Any])
- __init__()
- __init__(settings: QgsSettings, key: str | None = '')
Constructor from
QgsSettings
settings
object and rootkey
- Parameters:
settings (QgsSettings)
key (Optional[str] = '')
Deprecated since version 3.30: Use a variant map settings and the default constructor instead.
- __init__(key: str | None)
Constructor from default
QgsSettings
object and rootkey
- Parameters:
key (Optional[str])
- __init__(element: QDomElement)
Constructor from a QDomElement
element
- Parameters:
element (QDomElement)
- __init__(a0: QgsHttpHeaders)
- Parameters:
a0 (QgsHttpHeaders)
- headers(self) Dict[str, Any] [source]¶
Returns the headers as a variant map
Added in version 3.30.
- Return type:
Dict[str, Any]
- insert(self, key: str | None, value: Any)[source]¶
insert a
key
with the specificvalue
- Parameters:
key (Optional[str]) – a key to add
value (Any) – a value to add for the key
- keys(self) List[str] ¶
Returns the list of all HTTP header keys.
- Return type:
List[str]
- sanitizeKey(self, key: str | None) str [source]¶
Returns a cleansed
key
- Parameters:
key (Optional[str]) – a key to be sanitized
- Return type:
str
- setFromDomElement(self, element: QDomElement)[source]¶
Loads headers from the
element
key KEY_REFERER will be read from attribute “KEY_PREFIX+KEY_REFERER” and attribute “KEY_REFERER” (for backward compatibility)
- Parameters:
element (QDomElement)
- setFromMap(self, map: Dict[str, Any])[source]¶
Loads headers from the
map
key KEY_REFERER will be read from key “KEY_PREFIX+KEY_REFERER” and key “KEY_REFERER” (for backward compatibility)
- Parameters:
map (Dict[str, Any])
- setFromSettings(self, settings: QgsSettings, key: str | None = '')[source]¶
Loads headers from the
settings
key KEY_REFERER will be read at path “key/PATH_PREFIX/KEY_REFERER” and path “key/KEY_REFERER” (for backward compatibility)
- Parameters:
settings (QgsSettings)
key (Optional[str] = '') – sub group path
- setFromUrlQuery(self, uri: QUrlQuery)[source]¶
Loads headers from the
uri
- Parameters:
uri (QUrlQuery)
- toSpacedString(self) str [source]¶
Returns key/value pairs as strings separated by space
- Return type:
str
- updateDomElement(self, el: QDomElement) bool [source]¶
Updates a DOM element by adding all the HTTP headers
KEY_REFERER value will be available at attribute “KEY_PREFIX+KEY_REFERER” and attribute “KEY_REFERER” (for backward compatibility)
- Parameters:
el (QDomElement) – DOM element
- Return type:
bool
- Returns:
True
if the update succeed
Deprecated since version 3.42: Will be removed in QGIS 4.0.
- updateMap(self, map: Dict[str, Any]) bool [source]¶
Updates a
map
by adding all the HTTP headersKEY_REFERER value will be available at key “KEY_PREFIX+KEY_REFERER” and key “KEY_REFERER” (for backward compatibility)
- Return type:
bool
- Returns:
True
if the update succeed- Parameters:
map (Dict[str, Any])
- updateNetworkRequest(self, request: QNetworkRequest) bool [source]¶
Updates a
request
by adding all the HTTP headers- Return type:
bool
- Returns:
True
if the update succeed- Parameters:
request (QNetworkRequest)
- updateSettings(self, settings: QgsSettings, key: str | None = '') bool [source]¶
Updates the
settings
by adding all the http headers in the path “key/PATH_PREFIX/”KEY_REFERER value will be available at path “key/PATH_PREFIX/KEY_REFERER” and path “key/KEY_REFERER” (for backward compatibility)
- Parameters:
settings (QgsSettings)
key (Optional[str] = '') – sub group path
- Return type:
bool
- Returns:
True
if the update succeed
Deprecated since version 3.30: Directly use a variant setting instead.