Class: QgsServerRequest

class qgis.server.QgsServerRequest

Bases: sip.wrapper

Constructor

QgsServerRequest(url: str, method: QgsServerRequest.Method = QgsServerRequest.GetMethod, headers: Dict[str, str] = {}) Constructor

Parameters
  • url – the url string

  • method – the request method

  • headers

QgsServerRequest(url: QUrl, method: QgsServerRequest.Method = QgsServerRequest.GetMethod, headers: Dict[str, str] = {}) Constructor

Parameters
  • url – QUrl

  • method – the request method

  • headers

QgsServerRequest(other: QgsServerRequest) Copy constructor.

Methods

baseUrl

Returns the base URL of QGIS server

data

Returns post/put data Check for QByteArray.isNull() to check if data is available.

header

Returns the header value

headers

Returns the header map

method

rtype

QgsServerRequest.Method

methodToString

Returns a string representation of an HTTP request method.

originalUrl

Returns the request url as seen by the web server, by default this is equal to the url seen by QGIS server

parameter

Gets a parameter value

parameters

Returns a map of query parameters with keys converted to uppercase

queryParameter

Returns the query string parameter with the given name from the request URL, a defaultValue can be specified.

removeHeader

Remove an header

removeParameter

Remove a parameter

serverParameters

Returns parameters

setBaseUrl

Set the base URL of QGIS server

setHeader

Set an header

setMethod

Set the request method

setOriginalUrl

Set the request original url (the request url as seen by the web server)

setParameter

Set a parameter

setUrl

Set the request url

url

rtype

QUrl

Attributes

DeleteMethod

FORWARDED

GetMethod

HOST

HeadMethod

PatchMethod

PostMethod

PutMethod

X_FORWARDED_FOR

X_FORWARDED_HOST

X_FORWARDED_PROTO

X_QGIS_SERVICE_URL

X_QGIS_WCS_SERVICE_URL

X_QGIS_WFS_SERVICE_URL

X_QGIS_WMS_SERVICE_URL

X_QGIS_WMTS_SERVICE_URL

staticMetaObject

DeleteMethod = 4
FORWARDED = 1
GetMethod = 2
HOST = 0
HeadMethod = 0
class Method

Bases: int

baseClass

alias of qgis._server.QgsServerRequest

PatchMethod = 5
PostMethod = 3
PutMethod = 1
class RequestHeader

Bases: int

baseClass

alias of qgis._server.QgsServerRequest

X_FORWARDED_FOR = 2
X_FORWARDED_HOST = 3
X_FORWARDED_PROTO = 4
X_QGIS_SERVICE_URL = 5
X_QGIS_WCS_SERVICE_URL = 8
X_QGIS_WFS_SERVICE_URL = 7
X_QGIS_WMS_SERVICE_URL = 6
X_QGIS_WMTS_SERVICE_URL = 9
baseUrl(self)QUrl

Returns the base URL of QGIS server

E.g. if we call QGIS server with ‘http://example.com/folder?REQUEST=WMS&…’ the base URL will be ‘http://example.com/folder

New in version 3.20.

Return type

QUrl

data(self)QByteArray

Returns post/put data Check for QByteArray.isNull() to check if data is available.

Return type

QByteArray

header(self, name: str)str

Returns the header value

Parameters

name (str) – of the header

Returns

the header value or an empty string

header(self, headerEnum: QgsServerRequest.RequestHeader) -> str Returns the header value

Parameters

headerEnum – of the header

Return type

str

Returns

the header value or an empty string

headers(self)Dict[str, str]

Returns the header map

Return type

Dict[str, str]

Returns

the headers map

method(self)QgsServerRequest.Method
Return type

QgsServerRequest.Method

Returns

the request method

methodToString(method: QgsServerRequest.Method)str

Returns a string representation of an HTTP request method.

New in version 3.12.

Parameters

method (QgsServerRequest.Method) –

Return type

str

originalUrl(self)QUrl

Returns the request url as seen by the web server, by default this is equal to the url seen by QGIS server

See also

url()

New in version 3.6.

Return type

QUrl

parameter(self, key: str, defaultValue: str = '')str

Gets a parameter value

Parameters
  • key (str) –

  • defaultValue (str = '') –

Return type

str

parameters(self)Dict[str, str]

Returns a map of query parameters with keys converted to uppercase

Return type

Dict[str, str]

queryParameter(self, name: str, defaultValue: str = '')str

Returns the query string parameter with the given name from the request URL, a defaultValue can be specified.

New in version 3.10.

Parameters
  • name (str) –

  • defaultValue (str = '') –

Return type

str

removeHeader(self, name: str)

Remove an header

Parameters

name (str) –

New in version 3.20.

removeParameter(self, key: str)

Remove a parameter

Parameters

key (str) –

serverParameters(self)QgsServerParameters

Returns parameters

Return type

QgsServerParameters

setBaseUrl(self, url: QUrl)

Set the base URL of QGIS server

New in version 3.20.

Parameters

url (QUrl) –

setHeader(self, name: str, value: str)

Set an header

Parameters
  • name (str) –

  • value (str) –

setMethod(self, method: QgsServerRequest.Method)

Set the request method

Parameters

method (QgsServerRequest.Method) –

setOriginalUrl(self, url: QUrl)

Set the request original url (the request url as seen by the web server)

See also

setUrl()

New in version 3.6.

Parameters

url (QUrl) –

setParameter(self, key: str, value: str)

Set a parameter

Parameters
  • key (str) –

  • value (str) –

setUrl(self, url: QUrl)

Set the request url

Parameters

url (QUrl) –

staticMetaObject = <PyQt5.QtCore.QMetaObject object>
url(self)QUrl
Return type

QUrl

Returns

the request url as seen by QGIS server

See also

originalUrl()

server, by default the two are equal