python忽略证书验证urllib2 [英] python ignore certificate validation urllib2

查看:58
本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆