我试图使用urllib2
和python-ntlm
连接到一个经过NT认证的服务器,但是遇到了一个错误。我使用的代码来自the python-ntlm site:
user = 'DOMAIN\user.name'
password = 'Password123'
url = 'http://corporate.domain.com/page.aspx?id=foobar'
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, url, user, password)
# create the NTLM authentication handler
auth_NTLM = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman)
# create and install the opener
opener = urllib2.build_opener(auth_NTLM)
urllib2.install_opener(opener)
# retrieve the result
response = urllib2.urlopen(url)
return response.read()
我得到的错误是:
^{pr2}$你知道我做错什么了吗?在
尝试:
相关问题 更多 >
编程相关推荐