QWebEngineHttpRequest

The QWebEngineHttpRequest class holds a request to be sent with WebEngine . More

Inheritance diagram of PySide2.QtWebEngineCore.QWebEngineHttpRequest

Synopsis

Functions

Static functions

Detailed Description

QWebEngineHttpRequest represents an HTTP request in the WebEngine networking stack. It holds the information necessary to send a request over the network. It contains a URL and some ancillary information that can be used to modify the request. Both load() and load() accept a QWebEngineHttpRequest as a parameter.

class QWebEngineHttpRequest([url=QUrl()[, method=QWebEngineHttpRequest.Get]])

QWebEngineHttpRequest(other)

param url

QUrl

param method

Method

param other

QWebEngineHttpRequest

Constructs a QWebEngineHttpRequest object with url as the URL to be requested and method as the method to be used.

See also

url() setUrl()

Creates a copy of other .

PySide2.QtWebEngineCore.QWebEngineHttpRequest.Method

This enum type describes the method used to send the HTTP request:

Constant

Description

QWebEngineHttpRequest.Get

The GET method.

QWebEngineHttpRequest.Post

The POST method.

PySide2.QtWebEngineCore.QWebEngineHttpRequest.hasHeader(headerName)
Parameters

headerNameQByteArray

Return type

bool

Returns true if the header headerName is present in this WebEngine request.

PySide2.QtWebEngineCore.QWebEngineHttpRequest.header(headerName)
Parameters

headerNameQByteArray

Return type

QByteArray

Returns the header specified by headerName . If no such header is present, an empty QByteArray is returned, which may be indistinguishable from a header that is present but has no content (use hasHeader() to find out if the header exists or not).

Headers can be set with setHeader() .

PySide2.QtWebEngineCore.QWebEngineHttpRequest.headers()
Return type

Returns a list of all headers that are set in this WebEngine request. The list is in the order that the headers were set.

PySide2.QtWebEngineCore.QWebEngineHttpRequest.method()
Return type

Method

Returns the method this WebEngine request is using.

See also

setMethod()

PySide2.QtWebEngineCore.QWebEngineHttpRequest.__ne__(other)
Parameters

otherQWebEngineHttpRequest

Return type

bool

Returns false if this object is not the same as other .

See also

operator==()

PySide2.QtWebEngineCore.QWebEngineHttpRequest.__eq__(other)
Parameters

otherQWebEngineHttpRequest

Return type

bool

Returns true if this object is the same as other (that is, if they have the same method, URL, and headers).

See also

operator!=()

PySide2.QtWebEngineCore.QWebEngineHttpRequest.postData()
Return type

QByteArray

Returns the (raw) POST data this WebEngine request contains.

See also

setPostData()

static PySide2.QtWebEngineCore.QWebEngineHttpRequest.postRequest(url, postData)
Parameters
  • urlQUrl

  • postData

Return type

QWebEngineHttpRequest

Constructs a QWebEngineHttpRequest to url that uses the POST method.

Note

postData may contain arbitrary strings. They are translated to appropriate raw data.

PySide2.QtWebEngineCore.QWebEngineHttpRequest.setHeader(headerName, value)
Parameters
  • headerNameQByteArray

  • valueQByteArray

Sets the header headerName to be of value headerValue .

Note

Setting the same header twice overrides the previous setting. To accomplish the behavior of multiple HTTP headers of the same name, you should concatenate the two values, separating them with a comma (“,”) and set one single header.

PySide2.QtWebEngineCore.QWebEngineHttpRequest.setMethod(method)
Parameters

methodMethod

Sets the method this WebEngine request is using to be method .

See also

method()

PySide2.QtWebEngineCore.QWebEngineHttpRequest.setPostData(postData)
Parameters

postDataQByteArray

Sets the (raw) POST data this WebEngine request contains to be postData .

See also

postData()

PySide2.QtWebEngineCore.QWebEngineHttpRequest.setUrl(url)
Parameters

urlQUrl

Sets the URL this WebEngine request is referring to be url .

See also

url()

PySide2.QtWebEngineCore.QWebEngineHttpRequest.swap(other)
Parameters

otherQWebEngineHttpRequest

Swaps this WebEngine request with other . This function is very fast and never fails.

PySide2.QtWebEngineCore.QWebEngineHttpRequest.unsetHeader(headerName)
Parameters

headerNameQByteArray

Removes the header specified by key , if present.

PySide2.QtWebEngineCore.QWebEngineHttpRequest.url()
Return type

QUrl

Returns the URL this WebEngine request is referring to.

See also

setUrl()