Permanent cookies with QWebKit -- where to get the QNetworkAccessManager?

cookies, python, qt, qwebkit

Solution

You can get/set the cookie jar through `QWebView.page().networkAccessManager().cookieJar()`/`setCookieJar()`.

The Browser demo included with Qt (in C++) shows how to read and write cookies to disk.

Problem

I need to store cookies persistently in an application that uses QWebKit. I understand that I have to create a subclass of `QNetworkCookieJar` and attach it to a `QNetworkAccessManager`. But how do I attach this `QNetworkAccessManager` to my `QWebView` or get the `QNetworkAccessManager` used by it? I use Python 3 and PyQt if that is important.

Original source

Related problems