Python请求-SSLError(SSLError(“握手失败:错误([('SSL例程','tls_process_server_certificate','证书验证失败')

时间:2019-09-16 02:15:46

标签: python python-requests

从Linux执行以下curl命令可以正常工作-

curl -w "\n" -k --cert ~/pace.crt --key ~/pace.key --header "Accept: application/json" "https://url" -X GET;

当我尝试使用python请求从网址获取响应时,出现ssl错误:

certVal = ('location/pace.cert', 'location/pace.key')
methodName = 'GET'
urlLink = 'https://LinkToAdeviceConnectedToPC'
headersVal = {'Accept': 'application/json'}
res = requests.request(method=methodName, url=urlLink, headers=headersVal, cert=certVal)

错误:

Max retries exceeded with url: urllink (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

我尝试了论坛中建议的解决方案,但没有用。

0 个答案:

没有答案