QWebPage.__init__(self)
self.html = None
signal.signal(signal.SIGINT, signal.SIG_DFL)
self.connect(self, SIGNAL('loadFinished(bool)'), self._finished_loading)
self.mainFrame().load(QUrl(url))
self.app.exec_()

def _finished_loading(self, result):
    self.html = self.mainFrame().toHtml()
self.app.quit()
if __name__ == '__main__':
    pass
Screen scraping with Python