[PyQt] Setting a cookie for QtWebKit Example

Albert Cervera i Areny albert at nan-tic.com
Tue Aug 11 08:27:17 BST 2009


A Dimarts, 11 d'agost de 2009, Noah Gift va escriure:
> Hi,
>
> Does anyone have an example of how to set either accept all cookies for a
> QtWebKit Widget or manually set a cookie?

Yes, here [1] I've added support for storing and restoring all non-session 
cookies of a WebKit widget. To understand the code you just need to take a 
look at line 39 with the reimplementation of QNetworkCookieJar (which simply 
makes publics a couple of protected methods) and functions in line 70 and 90, 
which store and restore (respectively) all non-session cookies. As you can 
see, it's not enough to set the name and value, but you also need path, 
domain, etc.

Hope that helps!


[1] http://bazaar.launchpad.net/~openobject-client-kde/openobject-client-
kde/5.0/annotate/head%3A/Koo/Fields/Web/WebFieldWidget.py

>
> Thanks,
>
> Noah


-- 
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18


More information about the PyQt mailing list