Class: QgsNetworkReplyContent¶
- class qgis.core.QgsNetworkReplyContent¶
Bases:
sip.wrapper
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between threads.
New in version 3.6.
QgsNetworkReplyContent() Default constructor for an empty reply.
QgsNetworkReplyContent(reply: QNetworkReply) Constructor for
QgsNetworkReplyContent
, populated from the specifiedreply
.QgsNetworkReplyContent(
QgsNetworkReplyContent
)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.
Extracts the filename component of the content disposition header from the
header
.Extracts the filename component of the content disposition header from a network
reply
.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
- extractFileNameFromContentDispositionHeader(header: str) str ¶
Extracts the filename component of the content disposition header from the
header
.New in version 3.28.
- Parameters:
header (str) –
- Return type:
str
- extractFilenameFromContentDispositionHeader(reply: QNetworkReply) str ¶
Extracts the filename component of the content disposition header from a network
reply
.New in version 3.28.
- Parameters:
reply (QNetworkReply) –
- Return type:
str
- hasRawHeader(self, headerName: 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: 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