我試圖向受保護的網頁發出請求,因此我試圖在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)
什麼我錯在這裏做什麼?