Skip to content

Instantly share code, notes, and snippets.

@pib
Created October 27, 2011 16:42
Show Gist options
  • Save pib/1320092 to your computer and use it in GitHub Desktop.
Save pib/1320092 to your computer and use it in GitHub Desktop.
Injecting a QNetworkAccessManager
def inject(self, webview):
""" Replace the old QNetworkAccessManager instance with this
instance.
"""
old_manager = webview.page().networkAccessManager()
self.setCache(old_manager.cache())
self.setCookieJar(old_manager.cookieJar())
self.setProxy(old_manager.proxy())
self.setProxyFactory(old_manager.proxyFactory())
webview.page().setNetworkAccessManager(self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment