码迷,mamicode.com
首页 > Web开发 > 详细

requests.exceptions.SSLError: HTTPSConnectionPool(host='cn.bing.com', port=443)报错解决方案

时间:2020-06-02 13:25:22      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:sel   import   ror   htm   dog   failed   请求   gecko   请求头   

一、问题描述

运行以下代码

#!/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())

报错如下:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!