Created
May 27, 2012 05:10
-
-
Save v/2802245 to your computer and use it in GitHub Desktop.
PyQt Network Manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt4.QtGui import * | |
from PyQt4.QtCore import * | |
from PyQt4.QtWebKit import * | |
from PyQt4.QtNetwork import * | |
import sys | |
class Render(QWebPage): | |
def __init__(self, url): | |
self.app = QApplication(sys.argv) | |
QWebPage.__init__(self) | |
self.loadFinished.connect(self._loadFinished) | |
u = QUrl(url) | |
authenticator = QAuthenticator() | |
authenticator.setUser('username') | |
authenticator.setPassword('password') | |
self.manager = QNetworkAccessManager(self) | |
#I guess I'm just confused how to use this manager with the rest of my code. | |
self.manager.authenticationRequired.emit(<something>, authenticator) | |
self.mainFrame().load(u) | |
self.app.exec_() | |
def _loadFinished(self, result): | |
self.frame = self.mainFrame() | |
self.app.quit() | |
r = Render('http://mysite.com') | |
import pdb; pdb.set_trace() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment