当前位置:   article > 正文

requests.exceptions.SSLError: HTTPSConnectionPool Max retries exceeded with url 报错解决方法

requests.exceptions.SSLError: HTTPSConnectionPool Max retries exceeded with url 报错解决方法
import requests
import json

headers = {"Content-Type": "application/json"}
url = 'https://xxx'
d = {"var": [1, 2, 3]}
r = requests.post(url, headers=headers, json=d)  # 发get请求
print(r.status_code, r.json())
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

发现报错:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: certificate has expired (_ssl.c:1131)


requests.exceptions.SSLError: HTTPSConnectionPool(host='xxx', port=xxx): 
Max retries exceeded with url: /xxx 
(Caused by SSLError(SSLCertVerificationError
(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
certificate has expired (_ssl.c:1131)')))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

修改方法:

urlhttps 改为 http 不报错了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/182308
推荐阅读
相关标签
  

闽ICP备14008679号