Nyall Dawson eeb444948f Add mechanism for python clients to setup custom QNetworkReply
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
2022-05-02 12:31:42 +10:00
..
2021-03-22 21:13:52 +01:00