The PySide.QtNetwork.QNetworkReply class contains the data and meta data related to a request posted with PySide.QtNetwork.QNetworkAccessManager . Like PySide.QtNetwork.QNetworkRequest , it contains a URL and headers (both in parsed and raw form), some information about the reply’s state and the contents of the reply itself.
PySide.QtNetwork.QNetworkReply is a sequential-access PySide.QtCore.QIODevice , which means that once data is read from the object, it no longer kept by the device. It is therefore the application’s responsibility to keep this data if it needs to. Whenever more data is received from the network and processed, the PySide.QtCore.QIODevice.readyRead() signal is emitted.
The PySide.QtNetwork.QNetworkReply.downloadProgress() signal is also emitted when data is received, but the number of bytes contained in it may not represent the actual bytes received, if any transformation is done to the contents (for example, decompressing and removing the protocol overhead).
Even though PySide.QtNetwork.QNetworkReply is a PySide.QtCore.QIODevice connected to the contents of the reply, it also emits the PySide.QtNetwork.QNetworkReply.uploadProgress() signal, which indicates the progress of the upload for operations that have such content.
|Parameters:||parent – PySide.QtCore.QObject|
Creates a PySide.QtNetwork.QNetworkReply object with parent parent .
Indicates all possible error conditions found during the processing of the request.
|QNetworkReply.NoError||no error condition. Note: When the HTTP protocol returns a redirect no error will be reported. You can check if there is a redirect with the QNetworkRequest.RedirectionTargetAttribute attribute.|
|QNetworkReply.ConnectionRefusedError||the remote server refused the connection (the server is not accepting requests)|
|QNetworkReply.RemoteHostClosedError||the remote server closed the connection prematurely, before the entire reply was received and processed|
|QNetworkReply.HostNotFoundError||the remote host name was not found (invalid hostname)|
|QNetworkReply.TimeoutError||the connection to the remote server timed out|
|QNetworkReply.OperationCanceledError||the operation was canceled via calls to PySide.QtNetwork.QNetworkReply.abort() or PySide.QtNetwork.QNetworkReply.close() before it was finished.|
|QNetworkReply.SslHandshakeFailedError||the SSL/TLS handshake failed and the encrypted channel could not be established. The PySide.QtNetwork.QNetworkReply.sslErrors() signal should have been emitted.|
|QNetworkReply.TemporaryNetworkFailureError||the connection was broken due to disconnection from the network, however the system has initiated roaming to another access point. The request should be resubmitted and will be processed as soon as the connection is re-established.|
|QNetworkReply.ProxyConnectionRefusedError||the connection to the proxy server was refused (the proxy server is not accepting requests)|
|QNetworkReply.ProxyConnectionClosedError||the proxy server closed the connection prematurely, before the entire reply was received and processed|
|QNetworkReply.ProxyNotFoundError||the proxy host name was not found (invalid proxy hostname)|
|QNetworkReply.ProxyTimeoutError||the connection to the proxy timed out or the proxy did not reply in time to the request sent|
|QNetworkReply.ProxyAuthenticationRequiredError||the proxy requires authentication in order to honour the request but did not accept any credentials offered (if any)|
|QNetworkReply.ContentAccessDenied||the access to the remote content was denied (similar to HTTP error 401)|
|QNetworkReply.ContentOperationNotPermittedError||the operation requested on the remote content is not permitted|
|QNetworkReply.ContentNotFoundError||the remote content was not found at the server (similar to HTTP error 404)|
|QNetworkReply.AuthenticationRequiredError||the remote server requires authentication to serve the content but the credentials provided were not accepted (if any)|
|QNetworkReply.ContentReSendError||the request needed to be sent again, but this failed for example because the upload data could not be read a second time.|
|QNetworkReply.ProtocolUnknownError||the Network Access API cannot honor the request because the protocol is not known|
|QNetworkReply.ProtocolInvalidOperationError||the requested operation is invalid for this protocol|
|QNetworkReply.UnknownNetworkError||an unknown network-related error was detected|
|QNetworkReply.UnknownProxyError||an unknown proxy-related error was detected|
|QNetworkReply.UnknownContentError||an unknown error related to the remote content was detected|
|QNetworkReply.ProtocolFailure||a breakdown in protocol was detected (parsing error, invalid or unexpected responses, etc.)|
Aborts the operation immediately and close down any network connections still open. Uploads still in progress are also aborted.
|Parameters:||code – PySide.QtNetwork.QNetworkRequest.Attribute|
Returns the error that was found during the processing of this request. If no error was found, returns NoError .
|Parameters:||arg__1 – PySide.QtNetwork.QNetworkReply.NetworkError|
|Parameters:||headerName – PySide.QtCore.QByteArray|
Returns true if the raw header of name headerName was sent by the remote server
|Parameters:||header – PySide.QtNetwork.QNetworkRequest.KnownHeaders|
If this function is called, SSL errors related to network connection will be ignored, including certificate validation errors.
Be sure to always let the user inspect the errors reported by the PySide.QtNetwork.QNetworkReply.sslErrors() signal, and only call this method upon confirmation from the user that proceeding is ok. If there are unexpected errors, the reply should be aborted. Calling this method without inspecting the actual errors will most likely pose a security risk for your application. Use it with great care!
This function can be called from the slot connected to the PySide.QtNetwork.QNetworkReply.sslErrors() signal, which indicates which errors were found.
Returns true when the reply has finished or was aborted.
Returns true when the request is still processing and the reply has not finished or was aborted yet.
Returns the operation that was posted for this reply.
|Parameters:||headerName – PySide.QtCore.QByteArray|
Returns the raw contents of the header headerName as sent by the remote server. If there is no such header, returns an empty byte array, which may be indistinguishable from an empty header. Use PySide.QtNetwork.QNetworkReply.hasRawHeader() to verify if the server sent such header field.
Returns a list of headers fields that were sent by the remote server, in the order that they were sent. Duplicate headers are merged together and take place of the latter duplicate.
Returns a list of raw header pairs.
Returns the size of the read buffer, in bytes.
Returns the request that was posted for this reply. In special, note that the URL for the request may be different than that of the reply.
Sets the error condition to be errorCode . The human-readable message is set with errorString .
Calling PySide.QtNetwork.QNetworkReply.setError() does not emit the error( QNetworkReply.NetworkError ) signal.
|Parameters:||arg__1 – PySide.QtCore.bool|
Sets the reply as finished .
After having this set the replies data must not change.
|Parameters:||operation – PySide.QtNetwork.QNetworkAccessManager.Operation|
Sets the raw header headerName to be of value value . If headerName was previously set, it is overridden. Multiple HTTP headers of the same name are functionally equivalent to one single header with the values concatenated, separated by commas.
If headerName matches a known header, the value value will be parsed and the corresponding parsed form will also be set.
|Parameters:||size – PySide.QtCore.qint64|
Sets the size of the read buffer to be size bytes. The read buffer is the buffer that holds data that is being downloaded off the network, before it is read with QIODevice.read() . Setting the buffer size to 0 will make the buffer unlimited in size.
PySide.QtNetwork.QNetworkReply will try to stop reading from the network once this buffer is full (i.e., PySide.QtCore.QIODevice.bytesAvailable() returns size or more), thus causing the download to throttle down as well. If the buffer is not limited in size, PySide.QtNetwork.QNetworkReply will try to download as fast as possible from the network.
Unlike QAbstractSocket.setReadBufferSize() , PySide.QtNetwork.QNetworkReply cannot guarantee precision in the read buffer size. That is, PySide.QtCore.QIODevice.bytesAvailable() can return more than size .
|Parameters:||request – PySide.QtNetwork.QNetworkRequest|
Sets the associated request for this object to be request . This value will be returned by PySide.QtNetwork.QNetworkReply.request() .
Note: the request should be set when this object is created and not changed again.
|Parameters:||configuration – PySide.QtNetwork.QSslConfiguration|
Sets the SSL configuration for the network connection associated with this request, if possible, to be that of config .
|Parameters:||url – PySide.QtCore.QUrl|
Sets the URL being processed to be url . Normally, the URL matches that of the request that was posted, but for a variety of reasons it can be different (for example, a file path being made absolute or canonical).
Returns the SSL configuration and state associated with this reply, if SSL was used. It will contain the remote server’s certificate, its certificate chain leading to the Certificate Authority as well as the encryption ciphers in use.
The peer’s certificate and its certificate chain will be known by the time PySide.QtNetwork.QNetworkReply.sslErrors() is emitted, if it’s emitted.