Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Setting QList of cookies in QNetworkRequest in PySide
Maaaks last edited by
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') ]
But it doesn't work:
QNetworkRequest::setHeader: QVariant of type QVariantList cannot be used with header Cookie
So 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: