小编Pat*_*sen的帖子

类型错误:原生 Qt 信号不可调用

我正在尝试向受保护的网页发出请求,因此我尝试在QAuthenticator(). 但是,我收到以下错误:

mgr.authenticationRequired(response, auth)
TypeError: native Qt signal is not callable
Run Code Online (Sandbox Code Playgroud)

这是我的脚本的一部分:

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)
Run Code Online (Sandbox Code Playgroud)

我在这里做错了什么?

python authentication basic-authentication pyqt4 qnetworkaccessmanager

3
推荐指数
1
解决办法
8432
查看次数