requests.exceptions.SSLError: HTTPSConnectionPool(host='cn.bing.com', port=443)报错解决方
2021-02-12 12:22
标签:sel import ror htm dog failed 请求 gecko 请求头 一、问题描述 运行以下代码 报错如下: requests.exceptions.SSLError: HTTPSConnectionPool(host=‘cn.bing.com‘, port=443): Max retries exceeded with url: /tlookupv3?isVertical=1&&IG=1E1AE90B09BB41E28506E0ADC9E45704&IID=translator.5028.2 (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)‘))) 二、报错原因 电脑连打开了代理 三、解决方案 关闭代理即可。 requests.exceptions.SSLError: HTTPSConnectionPool(host='cn.bing.com', port=443)报错解决方案 标签:sel import ror htm dog failed 请求 gecko 请求头 原文地址:https://www.cnblogs.com/lxmtx/p/13030406.html#!/usr/local/bin/python3.7
import requests
import ssl
# 请求url
url = ‘https://cn.bing.com/tlookupv3?isVertical=1&&IG=1E1AE90B09BB41E28506E0ADC9E45704&IID=translator.5028.2‘
# 请求头
headers = {
‘User-Agent‘:‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36‘
}
# 请求formdata
formdata = {
‘from‘: ‘en‘,
‘to‘: ‘zh-Hans‘,
‘text‘: ‘dog‘
}
# 发送请求
r = requests.post(url, headers=headers, data=formdata)
print(r.json())
上一篇:图书管理的图书增删改查、choices参数、MTV与MVC模型、多对多关系的三种创建方式、Ajax操作、前后端传输数据编码格式、ajax发送json格式数据、ajax发送文件、django自带的序列化
文章标题:requests.exceptions.SSLError: HTTPSConnectionPool(host='cn.bing.com', port=443)报错解决方
文章链接:http://soscw.com/essay/54448.html