python忽略证书验证urllib2

编程入门 行业动态 更新时间:2024-10-27 02:25:50
本文介绍了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

本文发布于:2023-10-09 16:52:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1476245.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:证书   python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!