代码语言:javascript复制
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())
发现报错:
代码语言:javascript复制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
不报错了