Class: QgsHttpHeaders¶
This class 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 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
QgsSettingssettingsobject 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
QgsSettingsobject 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
keywith the specificvalue- Parameters:
 key (Optional[str]) – a key to add
value (Any) – a value to add for the key
- keys(self) List[str]¶
 - Return type:
 List[str]
- Returns:
 the list of all http header keys
- 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
elementkey 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
mapkey 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
settingskey 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:
 Trueif 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
mapby 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:
 Trueif the update succeed- Parameters:
 map (Dict[str, Any])
- updateNetworkRequest(self, request: QNetworkRequest) bool[source]¶
 Updates a
requestby adding all the HTTP headers- Return type:
 bool
- Returns:
 Trueif the update succeed- Parameters:
 request (QNetworkRequest)
- updateSettings(self, settings: QgsSettings, key: str | None = '') bool[source]¶
 Updates the
settingsby 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:
 Trueif the update succeed
Deprecated since version 3.30: Directly use a variant setting instead.