如何让 python httplib 接受不受信任的证书?我在我的网络服务器上创建了一个蛇油/自签名证书,我的 python 客户端无法连接,因为我使用的是不受信任的证书。
我宁愿在我的客户端代码中解决这个问题,而不是让它在我的系统上受信任。
import httplib
def main():
conn = httplib.HTTPSConnection("127.0.0.1:443")
conn.request("HEAD","/")
res = conn.getresponse()
print res.status, res.reason
data = res.read()
print len(data)
if __name__ == "__main__":
main()