An der Spitze meiner Python-Datei, die ich habe:Python Requests - Kann nicht importieren HTTPProxyAuth (Attribut: 'Modul' Objekt kein Attribut 'HTTPPRoxyAuth')
import requests
from requests.auth import HTTPPRoxyAuth
Die Linie auth = requests.auth.HTTPPRoxyAuth(username, password)
spuckt den Fehler AttributeError: 'module' object has no attribute 'HTTPPRoxyAuth'
, was führt zu einem ImportError: cannot import name HTTPPRoxyAuth
an der Importlinie.
Ich kann C:\Python27\Lib\site-packages\requests\auth.py
betrachten und die HTTPProxyAuth
Klasse sehen.
kann ich from requests.auth import *
verwenden und sehen Sie alle Module mit
g = globals().copy()
for name, obj in g.iteritems():
print name
und HTTPProxyAuth
in der Liste sehen, aber ich empfange noch eine AttributeError
.
Kann jemand erklären, warum es nicht richtig importiert? Ich verwende Python 2.7 und Anfragen 2.18.4