Class: QgsNetworkReplyContent¶
-
class
qgis.core.
QgsNetworkReplyContent
¶ Bases:
sip.wrapper
Default constructor for an empty reply.
QgsNetworkReplyContent(reply: QNetworkReply) Constructor for
QgsNetworkReplyContent
, populated from the specifiedreply
.QgsNetworkReplyContent(
QgsNetworkReplyContent
)Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between threads.
Methods
Returns the attribute associated with the
code
.Clears the reply, resetting it back to a default, empty reply.
Returns the reply content.
Returns the reply’s error message, or QNetworkReply.NoError if no error was encountered.
Returns the error text for the reply, or an empty string if no error was encountered.
Returns
True
if the reply contains a header with the specifiedheaderName
.Returns the content of the header with the specified
headerName
, or an empty QByteArray if the specified header was not found in the reply.Returns a list of raw header names contained within the reply.
Returns the original network request.
Returns the unique ID identifying the original request which this response was formed from.
Sets the reply content.
-
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()
- Parameters
code (QNetworkRequest.Attribute) –
- Return type
Any
-
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
- Return type
QByteArray
-
error
(self) → QNetworkReply.NetworkError¶ Returns the reply’s error message, or QNetworkReply.NoError if no error was encountered.
See also
- Return type
QNetworkReply.NetworkError
-
errorString
(self) → str¶ Returns the error text for the reply, or an empty string if no error was encountered.
See also
- Return type
str
-
hasRawHeader
(self, headerName: Union[QByteArray, bytes, bytearray]) → bool¶ Returns
True
if the reply contains a header with the specifiedheaderName
.See also
rawHeaderPairs()
See also
See also
- Parameters
headerName (Union[QByteArray) –
- Return type
bool
-
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
See also
- Parameters
headerName (Union[QByteArray) –
- Return type
QByteArray
-
rawHeaderList
(self) → List[QByteArray]¶ Returns a list of raw header names contained within the reply.
See also
rawHeaderPairs()
See also
See also
- Return type
List[QByteArray]
-
request
(self) → QNetworkRequest¶ Returns the original network request.
- Return type
QNetworkRequest
-
requestId
(self) → int¶ Returns the unique ID identifying the original request which this response was formed from.
- Return type
int
-