本文翻译自:InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately [duplicate]

This question already has an answer here: 这个问题在这里已有答案:

  • SSL InsecurePlatform error when using Requests package 14 answers 使用Requests包 14答案 时出现SSL InsecurePlatform错误

Tried to perform REST GET through python requests with the following code and I got error. 尝试使用以下代码通过python请求执行REST GET,我收到了错误。

Code snip: 代码片段:

import requests
header = {'Authorization': 'Bearer...'}
url = az_base_url + az_subscription_id + '/resourcegroups/Default-Networking/resources?' + az_api_version
r = requests.get(url, headers=header)

Error: 错误:

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.InsecurePlatformWarning

My python version is 2.7.3. 我的python版本是2.7.3。 I tried to install urllib3 and requests[security] as some other thread suggests, I still got the same error. 我尝试安装urllib3并请求[安全],因为其他线程建议,我仍然有同样的错误。

Wonder if anyone can provide some tips? 想知道是否有人可以提供一些提示?


#1楼

参考:https://stackoom.com/question/1yFDU/InsecurePlatformWarning-真正的SSLContext对象不可用-这可以防止urllib-适当地配置SSL-重复


#2楼

If you are not able to upgrade your Python version to 2.7.9, and want to suppress warnings, 如果您无法将Python版本升级到2.7.9,并且想要禁止警告,

you can downgrade your 'requests' version to 2.5.3: 您可以将“请求”版本降级到2.5.3:

pip install requests==2.5.3

Bugfix disclosure / Warning introduced in 2.6.0 2.6.0中引入了 Bugfix披露 / 警告


#3楼

The docs give a fair indicator of what's required. 文档给出了所需要的公平指标。 , however requests allow us to skip a few steps: 但是requests允许我们跳过几个步骤:

You only need to install the security package extras (thanks @admdrew for pointing it out) 您只需安装security 包附加功能 (感谢@admdrew指出)

$ pip install requests[security]

or, install them directly: 或者,直接安装它们:

$ pip install pyopenssl ndg-httpsclient pyasn1

Requests will then automatically inject pyopenssl into urllib3 请求将自动将pyopenssl注入urllib3


If you're on ubuntu, you may run into trouble installing pyopenssl , you'll need these dependencies: 如果您使用的是ubuntu,则可能在安装pyopenssl遇到问题,您需要这些依赖项:

$ apt-get install libffi-dev libssl-dev

InsecurePlatformWarning:真正的SSLContext对象不可用。这可以防止urllib3适当地配置SSL [重复]相关推荐

  1. pip安装模块警告InsecurePlatformWarning: A true SSLContext object is not available.

    在用pip7.1.2版本安装第三方模块时出现了如下警告: /usr/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/reques ...

  2. 运行python脚本时,报错InsecurePlatformWarning: A true SSLContext object is not available,解决方法

    运行python脚本时,报错InsecurePlatformWarning: A true SSLContext object is not available,解决方法 参考文章: (1)运行pyt ...

  3. oracle数据库升级导致的数据库对象不可用或无效解决办法

    前端时间,公司集体升级数据库版本,由于数据库的版本与服务器版本不对应导致升级失败,而我又没有提前对服务器进行数据备份,升级失败后导致,数据库无法使用,虽然可以连接进行查询查询操作,但是无法进行复杂的数 ...

  4. java 图片 哈希值_上传图片用图片文件的对象hash哈希值判断图片是否一样,避免重复提交相同的图片到服务器中...

    上传图片用图片文件的对象hash哈希值判断图片是否一样,避免重复提交相同的图片到服务器中 前端:要用到一个插件,点击下载 企业用户后台管理系统 - 谭人才招聘系统 function ajaxfile( ...

  5. kurento教程_Kurento自定义模块:媒体对象不可用(代码:40108)

    我能够成功构建并运行Chroma模块. 所以接下来我尝试做的是通过重命名所有出现的" chroma"来对源代码,makefile等进行简单的修改.对情感" (" ...

  6. 微信内置浏览器WeixinJSBridge对象还可用方法

    #http://mmlike.sinaapp.com/ 这个比较全的收集了WeixinJSBridge的功能,其中大部分不能用了,我常用到的是支付和关闭网页 用微信打开

  7. aws ec2 选择可用区_在AWS EC2上配置SQL Server Always On可用性组

    aws ec2 选择可用区 In this article, we will review how to set up multi-subnet Always On Availability grou ...

  8. Nginx+keepalived 实现高可用,防盗链及动静分离配置

    一.Nginx Rewrite 规则 1. Nginx rewrite规则 Rewrite规则含义就是某个URL重写成特定的URL(类似于Redirect),从某种意义上说为了美观或者对搜索引擎友好, ...

  9. 《高可用MySQL》2 – 单机版MySQL主从配置

    这里搭建的主从是最简单的单一主从复制(即一个Master和一个slave.没有不论什么的热机备份和多slave),该主从结构的基本拓扑图例如以下所看到的: 建立主要的主从复制能够总结为下面三个基本步骤 ...

最新文章

  1. (原創) 如何讓P7010外接螢幕支援1440x900(WXGA+)? (NB) (P7010)
  2. java 不识别enum_Java enum关键字不识别的快速解决办法
  3. php rsa加密乱码_php RSA加解密
  4. Mysql的日期查询方法
  5. Element-UI学习笔记-安装
  6. 菜鸟CTO谈物流科技:科学家也要贴地飞行
  7. 七种常用数据分析方法
  8. android 自定义控件实现3D画廊效果
  9. 路由器硬改+刷OpenWrt+挂载摄像头+U盘
  10. 向量点积衡量相似度_向量点积与叉积
  11. 材料科学基础学习指导-吕宇鹏-名词和术语解释-第8章:回复与再结晶
  12. LeetCode 1665. 完成所有任务的最少初始能量
  13. linux php-fpm 配置文件,linux下php-fpm开启与关闭方法
  14. FFMPEG 播放 RTSP视频流
  15. java实现数字金额转换成汉字大写金额
  16. mysql客户端与服务端的区别,终于彻底把握了
  17. 哲学家就餐(linux多线程)
  18. 雪山温泉海螺沟(二):去海螺沟
  19. javascript实现 文本过滤 找出一段文本中的所有数字/数值 并在去重后排序
  20. English Learning - L2-2 英音地道语音语调 [iː] [ɜː] [æ] 2023.02.23 周四

热门文章

  1. 仙之侠道2玖章各个任务详情_《仙之侠道Ⅱ柒章》任务全攻略 新手必看
  2. 苹果与高通的专利诉讼失利,将致前者在中国的市场份额下滑
  3. Android作为SocketServer以及手机IP问题
  4. Qt富文本 - 插入表格/列表/图片
  5. 时间真的就像海绵里的水,挤挤就会有吗?
  6. Android Weekly #29
  7. unity--shader graph--特效场景的建立
  8. 游戏高防服务器一个月多少钱
  9. 【晚甘园主人】话说岩茶和观音
  10. ssh StrictHostKeyChecking