PySide6.QtWebEngineCore.QWebEngineHttpRequest¶
- class QWebEngineHttpRequest¶
- The - QWebEngineHttpRequestclass holds a request to be sent with WebEngine .- Details- QWebEngineHttpRequestrepresents 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- QWebEngineHttpRequestas a parameter.- 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 - class Method¶
- This enum type describes the method used to send the HTTP request: - Constant - Description - QWebEngineHttpRequest.Method.Get - The GET method. - QWebEngineHttpRequest.Method.Post - The POST method. 
 - __init__(other)¶
- Parameters:
- other – - QWebEngineHttpRequest
 
 - Creates a copy of - other.- Constructs a - QWebEngineHttpRequestobject with- urlas the URL to be requested and- methodas the method to be used.- hasHeader(headerName)¶
- Parameters:
- headerName – - QByteArray
- Return type:
- bool 
 
 - Returns - trueif the header- headerNameis 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 (use- hasHeader()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 - falseif this object is not the same as- other.- See also - operator==()- __eq__(other)¶
- Parameters:
- other – - QWebEngineHttpRequest
- Return type:
- bool 
 
 - Returns - trueif this object is the same as- other(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 - QWebEngineHttpRequestto- urlthat uses the POST method.- Note - postDatamay contain arbitrary strings. They are translated to appropriate raw data.- See also - setHeader(headerName, value)¶
- Parameters:
- headerName – - QByteArray
- value – - QByteArray
 
 
 - Sets the header - headerNameto 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. - 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