赞
踩
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())
发现报错:
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)')))
修改方法:
把 url
的 https 改为 http
不报错了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。