Class: QgsHttpHeaders¶
- class qgis.core.QgsHttpHeaders¶
Bases:
sip.wrapper
This class implements simple http header management.
New in version 3.24.
QgsHttpHeaders(headers: Dict[str, Any]) Constructor from map
- Parameters:
headers –
QgsHttpHeaders() default constructor
QgsHttpHeaders(settings:
QgsSettings
, key: str = ‘’) Constructor fromQgsSettings
settings
object and rootkey
- Parameters:
settings –
key –
Deprecated since version QGIS: 3.30 use a variant map settings and the default constructor instead
QgsHttpHeaders(key: str) Constructor from default
QgsSettings
object and rootkey
- Parameters:
key –
QgsHttpHeaders(element: QDomElement) Constructor from a QDomElement
element
- Parameters:
element –
QgsHttpHeaders(
QgsHttpHeaders
)Methods
Returns the headers as a variant map
insert a
key
with the specificvalue
- rtype:
List[str]
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
map
by adding all the HTTP headersUpdates a
map
by adding all the HTTP headersUpdates a
request
by adding all the HTTP headersUpdates the
settings
by adding all the http headers in the path "key/PATH_PREFIX/"Updates an
uri
by adding all the HTTP headers- headers(self) Dict[str, Any] ¶
Returns the headers as a variant map
New in version 3.30.
- Return type:
Dict[str, Any]
- insert(self, key: str, value: Any)¶
insert a
key
with the specificvalue
- Parameters:
key (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) str ¶
Returns a cleansed
key
- Parameters:
key (str) – a key to be sanitized
- Return type:
str
- setFromDomElement(self, element: QDomElement)¶
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])¶
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) –
- setFromSettings(self, settings: QgsSettings, key: str = '')¶
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 (str = '') – sub group path
- setFromUrlQuery(self, uri: QUrlQuery)¶
Loads headers from the
uri
- Parameters:
uri (QUrlQuery) –
- toSpacedString(self) str ¶
Returns key/value pairs as strings separated by space
- Return type:
str
- updateDomElement(self, el: QDomElement) bool ¶
Updates a
map
by adding all the HTTP headersKEY_REFERER value will be available at attribute “KEY_PREFIX+KEY_REFERER” and attribute “KEY_REFERER” (for backward compatibility)
- Return type:
bool
- Returns:
True
if the update succeed- Parameters:
el (QDomElement) –
- updateMap(self, map: Dict[str, Any]) bool ¶
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) –
- updateNetworkRequest(self, request: QNetworkRequest) bool ¶
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 = '') bool ¶
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 (str = '') – sub group path
- Return type:
bool
- Returns:
True
if the update succeed
Deprecated since version QGIS: 3.30 directly use a variant setting instead
- updateUrlQuery(self, uri: QUrlQuery) bool ¶
Updates an
uri
by adding all the HTTP headers- Return type:
bool
- Returns:
True
if the update succeed- Parameters:
uri (QUrlQuery) –