QWebEngineHttpRequest#

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

Inheritance diagram of PySide6.QtWebEngineCore.QWebEngineHttpRequest

Synopsis#

Functions#

Static functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

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 PySide6.QtWebEngineCore.QWebEngineHttpRequest([url=QUrl()[, method=QWebEngineHttpRequest.Get]])#

PySide6.QtWebEngineCore.QWebEngineHttpRequest(other)

Parameters:

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.

PySide6.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.

PySide6.QtWebEngineCore.QWebEngineHttpRequest.hasHeader(headerName)#
Parameters:

headerNamePySide6.QtCore.QByteArray

Return type:

bool

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

PySide6.QtWebEngineCore.QWebEngineHttpRequest.header(headerName)#
Parameters:

headerNamePySide6.QtCore.QByteArray

Return type:

PySide6.QtCore.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() .

PySide6.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.

PySide6.QtWebEngineCore.QWebEngineHttpRequest.method()#
Return type:

Method

Returns the method this WebEngine request is using.

See also

setMethod()

PySide6.QtWebEngineCore.QWebEngineHttpRequest.__ne__(other)#
Parameters:

otherPySide6.QtWebEngineCore.QWebEngineHttpRequest

Return type:

bool

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

See also

operator==()

PySide6.QtWebEngineCore.QWebEngineHttpRequest.__eq__(other)#
Parameters:

otherPySide6.QtWebEngineCore.QWebEngineHttpRequest

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!=()

PySide6.QtWebEngineCore.QWebEngineHttpRequest.postData()#
Return type:

PySide6.QtCore.QByteArray

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

See also

setPostData()

static PySide6.QtWebEngineCore.QWebEngineHttpRequest.postRequest(url, postData)#
Parameters:
Return type:

PySide6.QtWebEngineCore.QWebEngineHttpRequest

Constructs a QWebEngineHttpRequest to url that uses the POST method.

Note

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

PySide6.QtWebEngineCore.QWebEngineHttpRequest.setHeader(headerName, value)#
Parameters:

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.

PySide6.QtWebEngineCore.QWebEngineHttpRequest.setMethod(method)#
Parameters:

methodMethod

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

See also

method()

PySide6.QtWebEngineCore.QWebEngineHttpRequest.setPostData(postData)#
Parameters:

postDataPySide6.QtCore.QByteArray

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

See also

postData()

PySide6.QtWebEngineCore.QWebEngineHttpRequest.setUrl(url)#
Parameters:

urlPySide6.QtCore.QUrl

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

See also

url()

PySide6.QtWebEngineCore.QWebEngineHttpRequest.swap(other)#
Parameters:

otherPySide6.QtWebEngineCore.QWebEngineHttpRequest

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

PySide6.QtWebEngineCore.QWebEngineHttpRequest.unsetHeader(headerName)#
Parameters:

headerNamePySide6.QtCore.QByteArray

Removes the header specified by key, if present.

PySide6.QtWebEngineCore.QWebEngineHttpRequest.url()#
Return type:

PySide6.QtCore.QUrl

Returns the URL this WebEngine request is referring to.

See also

setUrl()