我试图向受保护的网页发出请求,因此我试图在QAuthenticator()
的帮助下进行身份验证。不过,我得到以下错误:TypeError:本地Qt信号不可调用
mgr.authenticationRequired(response, auth)
TypeError: native Qt signal is not callable
这是我的脚本的一部分:
def authenticate(self):
username = 'user'
password = 'pass'
url = 'http://someurl.com'
mgr = QNetworkAccessManager(self)
auth = QAuthenticator()
auth.setUser(username)
auth.setPassword(password)
response = QNetworkRequest()
response.setUrl(QUrl(url))
mgr.authenticationRequired(mgr.get(response), auth)
什么我错在这里做什么?