Python python 如何发送带有 p12 证书的请求

岩岩 · 2021年04月20日 · 最后由 幺叁叁 回复于 2021年04月22日 · 2338 次阅读

有人说 python3 认证时只能提交 pem 格式的证书 我是把 p12 转成 pem 文件 然后 requests.get(url, cert="certpath/cert.pem") 但是 还是报 sslerror
这个该怎么办 期待老师的回答

共收到 2 条回复 时间 点赞

文件用这种形式传

files={'file':open("文件路径",'rb')}
r=requests.post(url=url,files=files)

https://2.python-requests.org/en/master/user/advanced/#verification
试下官方文档的写法;

requests.get('https://github.com', verify='/path/to/certfile')
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册