PyQt5 - QWebEngineUrlRequestInterceptor for server respons content

350 Views Asked by At

For developing my browser application, I have installed a QWebEngineUrlRequestInterceptor, so I can filter the URLs being reuquested. I would like to now be able to have a similar thing but for the server response content ie a theoretical QWebEngineServerResponseInterceptor kind of class. I am unaware of any classes that exist, and I don't even know whether the QtWebEngine even supports intercepting server responses, as this may go directly to the Chromium Networking Stack, and therefore bypass the QtWebEngine completely. I'd like to be able to read and modify Javascipt, html, etc... before it is loaded into the QWebEngineView.

I was thinking of blocking all URLs in the QWebEngineUrlRequestInterceptor, and then requesting them individually with a QNetworkAccessManager, however I think this is a bad idea because Qt switched to the Chromium Networking Stack for a reason and also whilst I could analyse the response with the QNetworkReply, I don't know how to load this into the QWebEngineView, or how to capture and load the POST data into the POST requests.

Is there some sort of workaround that I could use, in order to read and modify the server response content before it is loaded into the QWebEngineView?

0

There are 0 best solutions below