我正在尝试向受保护的网页发出请求,因此我尝试在QAuthenticator()
. 但是,我收到以下错误:
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)
我在这里做错了什么?