可以使用requests库来发送带证书的POST请求,示例代码如下:

import requests

url = 'https://example.com/api'
cert = ('path/to/cert.pem', 'path/to/key.pem')
data = {'key1': 'value1', 'key2': 'value2'}

response = requests.post(url, cert=cert, data=data)
print(response.content)

其中,cert参数为元组类型,第一个元素为证书文件路径,第二个元素为私钥文件路径。data参数为字典类型,为POST请求的数据。response.content为服务器返回的数据。

Python 使用 curl 带证书访问 POST 请求

原文地址: https://www.cveoy.top/t/topic/oPNi 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录