Setting QList of cookies in QNetworkRequest in PySide
-
I'm trying to make a kind of web web browser using QtWebKit in PySide, and I have noticed a problem in QNetworkRequest's "setHeader()":http://www.pyside.org/docs/pyside/PySide/QtNetwork/QNetworkRequest.html#PySide.QtNetwork.PySide.QtNetwork.QNetworkRequest.setHeader method. I'm trying to set cookies, and the documentation says that I need to give two arguments to setHeader: "QNetworkRequest.CookieHeader":http://www.pyside.org/docs/pyside/PySide/QtNetwork/QNetworkRequest.html#PySide.QtNetwork.PySide.QtNetwork.QNetworkRequest.KnownHeaders constant and a QList < QNetworkCookie >. Yes, I have read it in the PySide's docs, not in the Qt's.
But PySide doesn't have QList.
I've tried to give it a Python list:
@cookies = [ QNetworkCookie('lang','ru') ]
request.setHeader(QNetworkRequest.CookieHeader, cookies)@
But it doesn't work:bq.
QNetworkRequest::setHeader: QVariant of type QVariantList cannot be used with header CookieSo what do I need to do to set cookies without QList?
UPD. As a temporary solution, I currently use the "setRawHeader()":http://www.pyside.org/docs/pyside/PySide/QtNetwork/QNetworkRequest.html#PySide.QtNetwork.PySide.QtNetwork.QNetworkRequest.setRawHeader:
@request.setRawHeader("Cookie", "lang=ru")@