- 论坛徽章:
- 0
|
print "now in the main"
cj = cookielib.CookieJar()
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password( 'CCO','tools.cisco.com:443' , 'username', 'password')
opener = urllib2.build_opener(urllib2.HTTPSHandler(),auth_handler,urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
#opener = urllib2.build_opener( urllib2.HTTPSHandler())
URL_Start = "https://tools.cisco.com/CCIE/Schedule_Lab/CCIEOnline/jsp/UpdateProfile_Form.jsp"
try:
handle = urllib2.urlopen(URL_Start)
print handle.read()
except IOError, e:
if hasattr(e, 'code'):
if e.code != 401:
print 'We got another error'
print e.code
else:
print e.headers
print e.headers['www-authenticate']
html_data=urllib2.urlopen(URL_Start).read() |
始终包401错误,如果不登录这个https的页面就没问题 |
|