[PyQt] QWebEngineUrlRequestInterceptor doesn't work

redstone-cold redstone-cold at 163.com
Mon Jul 11 06:50:46 BST 2016


I think ,normally ,once the profile has been set, then the profile should work on subsequent requests, and if you follow this post to change your code
http://stackoverflow.com/questions/37658772/pyqt5-6-interceptrequest-doesnt-work
It works as expected.


I still cannot figure out why the strange behavior happened if we don't assign WebEngineUrlRequestInterceptor() to a variable






在2016年07月11 04时24分, "Kevin Mcintyre"<kebin70 at gmail.com>写道:


Just to clarify - it works for 1 request but on subsequent requests the profile needs to be set again?

QWebChannel has similar "incredible" behavior.

it's a little incredible...QWebChannel behaves similarly



On Sat, Jul 9, 2016 at 8:43 AM, redstone-cold <redstone-cold at 163.com> wrote:

That's incredible !
I think the the interceptor was used by profile.setRequestInterceptor(WebEngineUrlRequestInterceptor()), so it more or less was referenced by the profile, and it on earth was garbage collected later, that just sounds ridiculous!
Please help explain more, thanks !






在2016年07月03 05时59分, "Phil Thompson"<phil at riverbankcomputing.com>写道:


> On 2 Jul 2016, at 2:46 am, redstone-cold <redstone-cold at 163.com> wrote:
>
> someone says  It may be caused by python garbage collection
> http://stackoverflow.com/questions/37658772/pyqt5-6-interceptrequest-doesnt-work
>
> P.S. I tried the solution , it worked . but I cannot figure out why, can you explain it ?

setRequestInterceptor() doesn't take ownership of the interceptor and you aren't keeping a reference (either implicit or explicit) to it so it gets garbage collected.

Phil

> 在2016年07月02 05时03分, "Florian Bruhin"<me at the-compiler.org>写道:
>
> * redstone-cold <redstone-cold at 163.com> [2016-06-30 13:16:48 +0800]:
> > In my project, there is some need to get a certain requested URL in Chrome Dev Tools by Python during loading a web page,
> >
> > I think get the URL by Qt WebEngine is a good solution. I started by trying to use the code below to print out all the requested URLs during loading a web page,
> >
> > my code here https://bpaste.net/show/f2b1b67bdf96
> >
> > but it didn't work - no URL get printed at all , so what's wrong here ? Any good solutions ?
>
> I finally got around to updating to Qt 5.7 and trying this, and it
> doesn't work here either.
>
> I really can't see why, it seems to me like it should work... did you
> find out anything in the meantime?
>
> Florian
>
> --
> http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
>   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
>         I love long mails! | http://email.is-not-s.ms/
>
>
>  
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt



_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160711/06c41839/attachment.html>


More information about the PyQt mailing list