gpt4 book ai didi

python - python 中的curl --data-binary 相当于什么?

转载 作者:行者123 更新时间:2023-12-01 04:39:20 24 4
gpt4 key购买 nike

相当于什么:

curl --data-binary @myjarfile.jar localhost:10000/acceptjar

在 python 中使用请求 api?

.jar 文件是一个二进制文件,它被“发布”到期望接收该 jar 文件的服务器。

最佳答案

这不会处理错误,但应将文件作为八位字节流发送到服务器:

import requests
res = requests.post(url='http://example.com/post',
data=open('example.file', 'rb'),
headers={'Content-Type': 'application/octet-stream'})

关于python - python 中的curl --data-binary 相当于什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31108726/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com