[PyQt] save cookies and temp files to prefered folder

Florian Bruhin me at the-compiler.org
Sun May 11 22:16:24 BST 2014


Hi,

* Peter Irbizon <peterirbizon at gmail.com> [2014-05-11 23:05:55 +0200]:
> Hello, I am building simple web browser with pyqt.

Cool, I'm doing the same basically! (except maybe not simple :P)
Is your code available somewhere?

> Please how can I set in my app to store all cookies and temporary
> files to selected folder for opened website? Example is appreciated.

For temporary files: It depends what you mean exactly, but for things
like favicons/page cache/HTML5 storage/..., you simply need to do
something like:

    QWebSettings.globalSettings().setLocalStoragePath('/some/path')

See:

http://qt-project.org/doc/qt-4.8/qwebsettings.html#globalSettings
http://qt-project.org/doc/qt-4.8/qwebsettings.html#setLocalStoragePath


If you want caching of web content, it'll be a bit more complicated
though, I think you need to subclass QNetworkAccessManager and use a
QNetworkDiskCache.


For Cookies, you need to subclass QNetworkCookieJar and add some way
to save and load cookies.

Example:

http://git.the-compiler.org/qutebrowser/tree/qutebrowser/browser/cookies.py


I'd really like to hear more of your project! You can reach me under
this address via mail or Jabber, or in IRC (#pyqt on Freenode for
example).

Florian

-- 
() ascii ribbon campaign - stop html mail    www.asciiribbon.org
/\ www.the-compiler.org  | I love long mails http://email.is-not-s.ms/
Like winter snow on summer lawn, time past is time gone. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140511/e32c90de/attachment.sig>


More information about the PyQt mailing list