加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

Python常见问题 - python3 使用requests发送HTTPS请求报certific

发布时间:2020-12-20 10:05:48 所属栏目:Python 来源:网络整理
导读:当你使用? requests ?发送HTTPS请求时 ? requests.get(url,parmas=parmas,headers=header,cookies=cookie) ? 出现了以下错误 HTTPSConnectionPool(host= ' www.imooc.com ' ,port=443): Max retries exceeded with url: /api3/getbanneradvertver2 (Caused b

当你使用?requests?发送HTTPS请求时

?requests.get(url,parmas=parmas,headers=header,cookies=cookie)?

出现了以下错误

HTTPSConnectionPool(host='www.imooc.com',port=443): Max retries exceeded with url: /api3/getbanneradvertver2 (Caused by SSLError(SSLError(1,[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:847)'),))

?

出现原因

当你发送HTTPS请求时,需要SSL验证,而requests请求方法的?verify?参数默认是?True?,表示要进行验证

?

如何解决?

关掉验证即可,如下

requests.get(url,cookies=cookie,verify=False)?

?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读