python的httplib.HTTPSConnection会验证客户端服务器的证书吗
2个回答
展开全部
默认是不认证的。下面是一个https登录的代码
host = "www.user.com"
headers = {}
headers['Cookie'] = "sid=4783c845-ec9d-4ec4-a163-b67c254b8c85"
url = "/login.htm"
params = {"code":"1111",
"password":"pwd",
"username":"user"}
params = urllib.urlencode(params)
cookie = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie))
req = urllib2.Request("https://" + host + url)
response = opener.open(req, params)
for item in cookie:
print item.value, item.name
host = "www.user.com"
headers = {}
headers['Cookie'] = "sid=4783c845-ec9d-4ec4-a163-b67c254b8c85"
url = "/login.htm"
params = {"code":"1111",
"password":"pwd",
"username":"user"}
params = urllib.urlencode(params)
cookie = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie))
req = urllib2.Request("https://" + host + url)
response = opener.open(req, params)
for item in cookie:
print item.value, item.name
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询