Warum bekomme ich immer HTTP 407: Proxy-Authentifizierung Erforderlich?

Ich bin mit dem folgenden -

import urllib.request as req

proxy = req.ProxyHandler({'http': r'http://USER:PASS@PROXY:PORT'})
auth = req.HTTPBasicAuthHandler()
opener = req.build_opener(proxy, auth, req.HTTPHandler)
req.install_opener(opener)
conn = req.urlopen('http://google.com')
return_str = conn.read()

Hier ist mein traceback -

Traceback (most recent call last):
  File ".\proxy.py", line 8, in <module>
    conn = req.urlopen('http://google.com')
  File "D:\Python34\lib\urllib\request.py", line 153, in urlopen
    return opener.open(url, data, timeout)
  File "D:\Python34\lib\urllib\request.py", line 461, in open
    response = meth(req, response)
  File "D:\Python34\lib\urllib\request.py", line 571, in http_response
    'http', request, response, code, msg, hdrs)
  File "D:\Python34\lib\urllib\request.py", line 499, in error
    return self._call_chain(*args)
  File "D:\Python34\lib\urllib\request.py", line 433, in _call_chain
    result = func(*args)
  File "D:\Python34\lib\urllib\request.py", line 579, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 407: Proxy Authentication Required

Trotz, wie einfach diese sein sollte, ich bin immer 407: Proxy Authentication Required. Ich habe Tonnen von Fragen auf, SO dass über dieses problem, aber nicht finden können, eine Antwort, die funktioniert. Es scheint fast, als ob urllib ist nicht vorbei mein Anmeldeinformationen. Ich kann ein falsche Passwort und es nicht wieder meinen Spruch, dass die Anmeldeinformationen ungültig sind.

Was bin ich?

InformationsquelleAutor self. | 2014-09-19

Schreibe einen Kommentar