mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-29 00:07:54 -04:00
preprocessors
Since it's not possible to overwrite
QgsNetworkAccessManager::createRequest, the normal Qt approach for
adding custom handling for replies is not possible. This new API
adds a QgsNetworkAccessManager.setReplyPreprocessor() method
which allows clients to add a custom reply preprocessor for implementing
their own logic for replies.
For example:
def _on_ready_read(reply):
print(reply.peek(reply.bytesAvailable()))
def _my_preprocessor(request, reply):
if reply.operation() == QNetworkAccessManager.PutOperation:
reply.readyRead.connect(partial(_on_ready_read, reply))
QgsNetworkAccessManager.setReplyPreprocessor(_my_preprocessor)
Fixes #48169