[PyQt] QWebEngineUrlRequestInterceptor doesn't work

redstone-cold redstone-cold at 163.com
Sat Jul 9 16:43:05 BST 2016


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160709/811e205d/attachment.html>


More information about the PyQt mailing list