从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')],)",),))
我尝试了论坛中建议的解决方案,但没有用。