PySide6.QtWebEngineCore.QWebEngineHttpRequest¶
- class QWebEngineHttpRequest¶
The
QWebEngineHttpRequest
class holds a request to be sent with WebEngine . More…Synopsis¶
Methods¶
def
__init__()
def
hasHeader()
def
header()
def
headers()
def
method()
def
__ne__()
def
__eq__()
def
postData()
def
setHeader()
def
setMethod()
def
setPostData()
def
setUrl()
def
swap()
def
unsetHeader()
def
url()
Static functions¶
def
postRequest()
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. Bothload()
andload()
accept aQWebEngineHttpRequest
as a parameter.- class 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.
- __init__(other)¶
- Parameters:
other –
QWebEngineHttpRequest
Creates a copy of
other
.Constructs a
QWebEngineHttpRequest
object withurl
as the URL to be requested andmethod
as the method to be used.- hasHeader(headerName)¶
- Parameters:
headerName –
QByteArray
- Return type:
bool
Returns
true
if the headerheaderName
is present in this WebEngine request.See also
- header(headerName)¶
- Parameters:
headerName –
QByteArray
- Return type:
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 (usehasHeader()
to find out if the header exists or not).Headers can be set with
setHeader()
.See also
- headers()¶
- Return type:
.list of QByteArray
Returns a list of all headers that are set in this WebEngine request. The list is in the order that the headers were set.
See also
Returns the method this WebEngine request is using.
See also
- __ne__(other)¶
- Parameters:
other –
QWebEngineHttpRequest
- Return type:
bool
Returns
false
if this object is not the same asother
.See also
operator==()
- __eq__(other)¶
- Parameters:
other –
QWebEngineHttpRequest
- Return type:
bool
Returns
true
if this object is the same asother
(that is, if they have the same method, URL, and headers).See also
operator!=()
- postData()¶
- Return type:
Returns the (raw) POST data this WebEngine request contains.
See also
- static postRequest(url, postData)¶
- Parameters:
url –
QUrl
postData – Dictionary with keys of type .QString and values of type QString.
- Return type:
Constructs a
QWebEngineHttpRequest
tourl
that uses the POST method.Note
postData
may contain arbitrary strings. They are translated to appropriate raw data.See also
- setHeader(headerName, value)¶
- Parameters:
headerName –
QByteArray
value –
QByteArray
Sets the header
headerName
to be of valueheaderValue
.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.
See also
Sets the method this WebEngine request is using to be
method
.See also
- setPostData(postData)¶
- Parameters:
postData –
QByteArray
Sets the (raw) POST data this WebEngine request contains to be
postData
.See also
Sets the URL this WebEngine request is referring to be
url
.See also
- swap(other)¶
- Parameters:
other –
QWebEngineHttpRequest
Swaps this WebEngine request with
other
. This function is very fast and never fails.- unsetHeader(headerName)¶
- Parameters:
headerName –
QByteArray
Removes the header specified by
key
, if present.See also
Returns the URL this WebEngine request is referring to.
See also