本文介绍了python忽略证书验证urllib2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在向带有公司内部链接的服务器发出请求期间忽略认证验证.
I want to ignore the certification validation during my request to the server with an internal corporate link.
使用 python requests 库,我会这样做:
With python requests library I would do this:
r = requests.get(link, allow_redirects=False,verify=False)我如何对 urllib2 库做同样的事情?
How do I do the same with urllib2 library?
推荐答案urllib2 默认不验证服务器证书.检查此文档.
urllib2 does not verify server certificate by default. Check this documentation.
正如下面评论中所指出的,对于较新版本(似乎 >= 2.7.9)的 Python,这不再适用.请参阅下面的答案
As pointed out in below comment, this is not true anymore for newer versions (seems like >= 2.7.9) of Python. Refer the below ANSWER
更多推荐
python忽略证书验证urllib2
发布评论