python2/3 发送https请求时,告警关闭方法
问题:
使用Python3 requests发送HTTPS请求,已经关闭认证(verify=False)情况下,控制台会输出以下错误:
InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
解决方法:
在代码中添加以下代码即可解决:
|
1
2
|
import urllib3urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
Python2添加如下代码即可解决:
|
1
2
3
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning# 禁用安全请求警告requests.packages.urllib3.disable_warnings(InsecureRequestWarning) |
python2/3 发送https请求时,告警关闭方法的更多相关文章
- requests发送HTTPS请求(处理SSL证书验证)
1.SSL是什么,为什么发送HTTPS请求时需要证书验证? 1.1 SSL:安全套接字层.是为了解决HTTP协议是明文,避免传输的数据被窃取,篡改,劫持等. 1.2 TSL:Transport Lay ...
- Python常见问题 - python3 使用requests发送HTTPS请求报certificate verify failed 错误
当你使用 requests 发送HTTPS请求时 requests.get(url, parmas=parmas, headers=header, cookies=cookie) 出现了以下错误 HT ...
- 使用HttpClient发送HTTPS请求以及配置Tomcat支持SSL
这里使用的是HttpComponents-Client-4.1.2 package com.jadyer.util; import java.io.File; import java.io.FileI ...
- 【转载】JMeter学习(三十六)发送HTTPS请求
Jmeter一般来说是压力测试的利器,最近想尝试jmeter和BeanShell进行接口测试.由于在云阅读接口测试的过程中需要进行登录操作,而登录请求是HTTPS协议.这就需要对jmeter进行设置. ...
- Web Server 使用WebClient 发送https请求 The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel
使用WebClient 发送https请求 使用WebClient发送请求时,并且是以https协议: WebClient webClient = new WebClient(); string re ...
- JMeter学习(三十六)发送HTTPS请求(转载)
转载自 http://www.cnblogs.com/yangxia-test Jmeter一般来说是压力测试的利器,最近想尝试jmeter和BeanShell进行接口测试.由于在云阅读接口测试的过程 ...
- 通过 Apache Commons HttpClient 发送 HTTPS 请求
1.通过 HTTPS 发送 POST 请求: 2.HTTPS 安全协议采用 TLSv1.2: 3. 使用代理(Proxy)进行 HTTPS 访问: 4.指定 Content-Type 为:applic ...
- Feign发送Get请求时,采用POJO对象传递参数的最终解决方案 Request method 'POST' not supported (附带其余好几个坑)
yml: feign: httpclient: enabled: true properties: #feign feign.httpclient.enabled=true <!-- https ...
- python发送requests请求时,使用登录的token值,作为下一个接口的请求头信息
背景介绍: 发送搜索请求时,需要用到登录接口返回值中的token值 代码实现: 登录代码: 搜索接口:
随机推荐
- C++练习 | 求解二叉树的高度
int h(BTree *bt) { if(bt->lchild==NULL&&bt->rchild==NULL) ; if(bt->lchild!=NULL& ...
- K8S学习心得 == 创建容器influxdb的RC和SVC
附上:YAML在线检查:http://nodeca.github.io/js-yaml Part 1: 部署Influxdb的RC文件,步骤如下: step 1: influxdb-rc.yaml文件 ...
- transfrom、transition、animation区别
transfrom transform是静态属性,非动画属性,和margin-left.margin-top类似. translate:平移,类似position:relative;translate ...
- rails + MySQL 存储emoji表情 😯
database.yml 加入 charset: utf8mb4 encoding: utf8mb4 collation: utf8mb4_unicode_ci 创建migration ,更改要存放表 ...
- 关于typedef在struct使用上的一些问题
typedef struct lnode{ int data; struct lnode next; }lnode,linklist; 第一行的lnode是结构体名,最后一行的lnode是由typed ...
- LintCode 896. Prime Product 简明题解
Given a non-repeating prime array arr, and each prime number is used at most once, find all the prod ...
- markupsafe._compat出错的解决办法
在windows下用pip进行安装的flask和freeze会在运行程序的时候出现报错 markupsafe._compat出错,那么此时找到对应的pip文件夹下自己创建一个_compat.py 然后 ...
- NodeJS设置Header解决跨域问题
转载: NodeJS设置Header解决跨域问题 app.all('*', function (req, res, next) { res.header('Access-Control-Allow-O ...
- 20155239 实验四 Android程序设计
20155239 实验四 Android程序设计 目录 第24章:初识Android 任务一: 完成Hello World, 要求修改res目录中的内容,Hello World后要显示自己的学号 学习 ...
- day8 opencv3 ,没有GMG MOG
Traceback (most recent call last): File , in <module> fgbg = cv2.createBackgroundSubtractorGMG ...