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 from QgsSettings settings object and root key

Parameters:
  • settings

  • key

QgsHttpHeaders(key: str) Constructor from default QgsSettings object and root key

Parameters:

key

QgsHttpHeaders(element: QDomElement) Constructor from a QDomElement element

Parameters:

element

QgsHttpHeaders(QgsHttpHeaders)

Methods

insert

insert a key with the specific value

keys

rtype:

List[str]

sanitizeKey

Returns a cleansed key

setFromDomElement

Loads headers from the element

setFromMap

Loads headers from the map

setFromSettings

Loads headers from the settings

setFromUrlQuery

Loads headers from the uri

toSpacedString

Returns key/value pairs as strings separated by space

updateDomElement

Updates a map by adding all the HTTP headers

updateMap

Updates a map by adding all the HTTP headers

updateNetworkRequest

Updates a request by adding all the HTTP headers

updateSettings

Updates the settings by adding all the http headers in the path "key/PATH_PREFIX/"

updateUrlQuery

Updates an uri by adding all the HTTP headers

insert(self, key: str, value: Any)

insert a key with the specific value

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 headers

KEY_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 headers

KEY_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

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) –