Class: QgsNetworkReplyContent

class qgis.core.QgsNetworkReplyContent

Bases: sip.wrapper

Default constructor for an empty reply.

QgsNetworkReplyContent(reply: QNetworkReply) Constructor for QgsNetworkReplyContent, populated from the specified reply.

QgsNetworkReplyContent(QgsNetworkReplyContent)

Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between threads.

New in version 3.6: Enums

Methods

attribute

Returns the attribute associated with the code.

clear

Clears the reply, resetting it back to a default, empty reply.

content

Returns the reply content.

error

Returns the reply’s error message, or QNetworkReply.NoError if no error was encountered.

errorString

Returns the error text for the reply, or an empty string if no error was encountered.

hasRawHeader

Returns True if the reply contains a header with the specified headerName.

rawHeader

Returns the content of the header with the specified headerName, or an empty QByteArray if the specified header was not found in the reply.

rawHeaderList

Returns a list of raw header names contained within the reply.

request

Returns the original network request.

requestId

Returns the unique ID identifying the original request which this response was formed from.

setContent

Sets the reply content.

Signals

Attributes

attribute(self, code: QNetworkRequest.Attribute) → Any

Returns the attribute associated with the code. If the attribute has not been set, it returns an invalid QVariant.

You can expect the default values listed in QNetworkRequest.Attribute to be applied to the values returned by this function.

See also

attributes()

clear(self)

Clears the reply, resetting it back to a default, empty reply.

content(self) → QByteArray

Returns the reply content. This is not available by default, as reading network reply content can only be done once.

Blocking network requests (see QgsBlockingNetworkRequest) will automatically populate this content.

See also

setContent()

error(self) → QNetworkReply.NetworkError

Returns the reply’s error message, or QNetworkReply.NoError if no error was encountered.

See also

errorString()

errorString(self) → str

Returns the error text for the reply, or an empty string if no error was encountered.

See also

error()

hasRawHeader(self, headerName: Union[QByteArray, bytes, bytearray]) → bool

Returns True if the reply contains a header with the specified headerName.

See also

rawHeaderPairs()

See also

rawHeaderList()

See also

rawHeader()

rawHeader(self, headerName: Union[QByteArray, bytes, bytearray]) → QByteArray

Returns the content of the header with the specified headerName, or an empty QByteArray if the specified header was not found in the reply.

See also

rawHeaderPairs()

See also

hasRawHeader()

See also

rawHeaderList()

rawHeaderList(self) → List[QByteArray]

Returns a list of raw header names contained within the reply.

See also

rawHeaderPairs()

See also

hasRawHeader()

See also

rawHeader()

request(self) → QNetworkRequest

Returns the original network request.

requestId(self) → int

Returns the unique ID identifying the original request which this response was formed from.

setContent(self, content: Union[QByteArray, bytes, bytearray])

Sets the reply content. This is not done by default, as reading network reply content can only be done once.

See also

content()