httplib.HTTPSConnection问题:CERTIFICATE_VERIFY_FAILED

时间:2016-10-09 16:11:45

标签: python

我正在尝试使用httplib库访问网站,但我收到此错误:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:590)

c = httplib.HTTPSConnection('IP', 443)
c.request(method,url);

因为证书是自签名的。如何禁用证书验证?

谢谢!

1 个答案:

答案 0 :(得分:5)

How do I have python httplib accept untrusted certs?

httplib.HTTPSConnection(hostname, timeout=5, context=ssl._create_unverified_context())