题
所以我正在尝试使用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
[/蟒]
我的错误是ValueError:AbstractDigestAuthHandler不了解基本的
我尝试过使用Basic HTML Authorization处理程序甚至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 ),您的网址中出现错误 - 要使其正常工作,我已经包括http://部分,不仅仅是主持人。
不隶属于 StackOverflow