小编Mat*_*att的帖子

在QWebView中设置useragent

我有一个QWebView,工作正常.然后,使用spynner中的代码,我尝试将useragent方法绑定到自定义方法.这似乎适用于spynner(使用QWebPage),但不在此处.任何帮助非常感谢.码:

def customuseragent(url):
 print 'called for %s' % url
 return 'custom ua'


#inside a class
self.webkit = QtWebKit.QWebView()
self.webkit.page().userAgentForUrl = customuseragent
self.webkit.load(QtCore.QUrl('http://www.whatsmyuseragent.com/'))
Run Code Online (Sandbox Code Playgroud)

python pyqt4 qwebview qwebpage

4
推荐指数
2
解决办法
5103
查看次数

标签 统计

pyqt4 ×1

python ×1

qwebpage ×1

qwebview ×1