内容表

上一话题

QWebEngineCookieStore

下一话题

QWebEngineUrlRequestInfo

QWebEngineHttpRequest

QWebEngineHttpRequest class holds a request to be sent with WebEngine . 更多

Inheritance diagram of PySide2.QtWebEngineCore.QWebEngineHttpRequest

概要

函数

静态函数

详细描述

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

方法

param other

QWebEngineHttpRequest

构造 QWebEngineHttpRequest object with url as the URL to be requested and 方法 as the method to be used.

另请参阅

url() setUrl()

Creates a copy of other .

PySide2.QtWebEngineCore.QWebEngineHttpRequest. 方法

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

常量

描述

QWebEngineHttpRequest.Get

The GET method.

QWebEngineHttpRequest.Post

The POST method.

PySide2.QtWebEngineCore.QWebEngineHttpRequest. hasHeader ( headerName )
参数

headerName QByteArray

返回类型

bool

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

PySide2.QtWebEngineCore.QWebEngineHttpRequest. header ( headerName )
参数

headerName QByteArray

返回类型

QByteArray

Returns the header specified by headerName 。若不存在这种 Header 头,空 QByteArray 被返回,可能难以区分存在但没有内容的 Header 头 (使用 hasHeader() to find out if the header exists or not).

Headers can be set with setHeader() .

PySide2.QtWebEngineCore.QWebEngineHttpRequest. headers ( )
返回类型

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. 方法 ( )
返回类型

方法

Returns the method this WebEngine request is using.

另请参阅

setMethod()

PySide2.QtWebEngineCore.QWebEngineHttpRequest. __ne__ ( other )
参数

other QWebEngineHttpRequest

返回类型

bool

返回 false if this object is not the same as other .

另请参阅

operator==()

PySide2.QtWebEngineCore.QWebEngineHttpRequest. __eq__ ( other )
参数

other QWebEngineHttpRequest

返回类型

bool

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

另请参阅

operator!=()

PySide2.QtWebEngineCore.QWebEngineHttpRequest. postData ( )
返回类型

QByteArray

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

另请参阅

setPostData()

static PySide2.QtWebEngineCore.QWebEngineHttpRequest. postRequest ( url , postData )
参数
  • url QUrl

  • postData

返回类型

QWebEngineHttpRequest

构造 QWebEngineHttpRequest to url that uses the POST method.

注意

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

PySide2.QtWebEngineCore.QWebEngineHttpRequest. setHeader ( headerName , value )
参数
  • headerName QByteArray

  • value QByteArray

设置 Header 头 headerName 到值 headerValue .

注意

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 ( 方法 )
参数

方法 方法

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

另请参阅

method()

PySide2.QtWebEngineCore.QWebEngineHttpRequest. setPostData ( postData )
参数

postData QByteArray

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

另请参阅

postData()

PySide2.QtWebEngineCore.QWebEngineHttpRequest. setUrl ( url )
参数

url QUrl

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

另请参阅

url()

PySide2.QtWebEngineCore.QWebEngineHttpRequest. swap ( other )
参数

other QWebEngineHttpRequest

交换此 WebEngine request with other 。此函数非常快,且从不失败。

PySide2.QtWebEngineCore.QWebEngineHttpRequest. unsetHeader ( headerName )
参数

headerName QByteArray

Removes the header specified by key , if present.

PySide2.QtWebEngineCore.QWebEngineHttpRequest. url ( )
返回类型

QUrl

Returns the URL this WebEngine request is referring to.

另请参阅

setUrl()