我有一个python片段用于将文件发布到URL:
import requests
url = 'http://www.test.com/route'
files = {'pdf': open('/path/to/file/abc.pdf', 'rb'), 'variable_1': '1', 'variable_2': '2'}
r = requests.post(url, files=files)
print(r.status_code)
有效!我正在寻找相同的cURL等价物!
我试过这个:
curl -X POST http://www.test.com/route -H 'content-type: application/json' -F pdf=@/path/to/file/abc.pdf -F variable_1=1 -F variable_2=2
什么是正确的卷曲?谢谢!