문제
그래서 나는 python으로 vsearch.cisco.com이라는 사이트에서 파일을 다운로드하려고합니다.
파이썬
#Connects to the Cisco Server and Downloads files at the URL specified
import urllib2
#Define Useful Variables
url = 'http://vsearch.cisco.com'
username = 'xxxxxxxx'
password = 'xxxxxxxx'
realm = 'CEC'
# Begin Making connection
# Create a Handler -- Also could be where the error lies
handler = urllib2.HTTPDigestAuthHandler()
handler.add_password(realm,url,username,password)
# Create an Opener
opener = urllib2.build_opener(handler)
urllib2.install_opener(opener)
try:
urllib2.urlopen(url)
print f.read()
except urllib2.HTTPError, e:
print e.code
print e.header
/Python
내 오류는 ValueError입니다 : AbstractDigestauthhandler는 BASIC에 대해 모릅니다.
기본 HTML 인증 처리기 및 HTTPS 핸들러를 사용해 보았습니다. 아무것도 나에게 접근 할 수 없습니다. 그러나이 오류는 다른 모든 오류와 다릅니다. 다른 오류는 단순히 401 HTML 오류입니다
이 작업을 수행하는 방법에 대한 제안이 있습니까?
올바른 솔루션이 없습니다
다른 팁
"비밀번호 관리자"가 도움이 될 수 있습니다.
mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
mgr.add_password(None, url, user, password)
urllib2.build_opener(urllib2.HTTPBasicAuthHandler(mgr),
urllib2.HTTPDigestAuthHandler(mgr))
내 테스트에서 시도한 것에 관해서 (http://devel.almad.net/trac/django-http-digest/browser/djangohttpdigest/tests/test_simple_digest.py), Or
제휴하지 않습니다 StackOverflow