Форум сайта python.su
class Webber(QtGui.QMainWindow):
def __init__(self,cookieFile):
QtGui.QMainWindow.__init__(self)
self.resize(800,600)
quit = QtGui.QPushButton('Cookies', self)
quit.setGeometry(10, 10, 60, 35)
self.connect(quit, QtCore.SIGNAL('clicked()'),self.printer)
cj = cookielib.LWPCookieJar()
if os.path.isfile(cookieFile):
cj.load(cookieFile)
self.view = QtWebKit.QWebView(self)
self.page=QtWebKit.QWebPage()
self.manager=QtNetwork.QNetworkAccessManager()
self.cj=QtNetwork.QNetworkCookieJar()
self.manager.setCookieJar(self.cj)
#manger.setProxy(QtWebKit.QNetworkProxy)
self.page.setNetworkAccessManager(self.manager)
self.view.setPage(self.page)
self.view.setGeometry(100, 200, 500, 300)
self.view.load(QtCore.QUrl('http://www.google.com.ua/'))
self.view.show()
def printer(self):
print self.cj.allCookies()
Офлайн