python requests请求报错Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED]

SSLError: HTTPSConnectionPool(host='xx.xxx.com', port=443): Max retries exceeded with url: /api/v1/service/xxx (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))

解决方案如下:
requests请求时关闭ssl验证即可 添加参数verify=False

url = 'https://api.chatxxx.com/api/v1/service/xxx'
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer xxxxxxxxx'
}
response = requests.request("POST", url, headers=headers, data=payload,verify=False)
print(response.text)

你可能感兴趣的:(python,ssl,服务器)