The QNetworkProxy.setPassword()
is not a class method but an instance method. So create an instance of QNetworkProxy then set user/password on that:
def __init__(self, url):
networkProxy = QNetworkProxy(QNetworkProxy.Socks5Proxy, "proxy5.com", 1080)
networkProxy.setPassword('password')
networkProxy.setUser('user')
QNetworkProxy.setApplicationProxy(networkProxy)
(I've checked the above is correct syntax, but obviously the socks5 host (proxy5.com), port, user and password would have to be correct). If still doesn't work for you, then problem is somewhere else, please clarify by editing your question.