python - Python 请求 - SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')
问题描述
从 linux 执行时,以下 curl 命令可以正常工作 -
curl -w "\n" -k --cert ~/pace.crt --key ~/pace.key --header "Accept: application/json" "https://url" -X GET;
当我尝试使用 python 请求从 url 获取响应时,我收到 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')],)",),))
我尝试了论坛中建议的解决方案,但没有奏效。
解决方案
推荐阅读
- ruby - 如何在 Ruby 中为旅行费用计划存储多个用户响应
- php - 获取表记录,除了在另一个表中具有外键值的记录
- angular - 非嵌套组件的数据绑定
- pyqt5 - 如何过滤 QListWidget 中的项目
- linker - 链接 SFML 文件时 dev c++ 中的链接器错误
- postgresql - Liquibase - 将数据库从 PostgreSQL 迁移到 Microsoft SQL Server
- php - phpmailer - 是否可以使用 html 文件的指定路径调用消息正文?
- html - SVG 矩形到路径
- winforms - Visual Studio PowerShell 将附件从 Outlook 拖放到列表框
- python - 在groupby Python中限制平均值的小数