|
本帖最后由 4463424 于 2023-10-12 19:24 编辑
以下是curl python两种语言的方法,我现在想把这个转换成火山的WinHttp,请高手指点下,谢谢!!!!!
curl示例
curl -F 'file=@/Downloads/filename.jpg' "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=xxx&method=upload&type=tmpfile&path=/apps/AppName/filename.jpg&uploadid=N1-NjEuMTM1LjE2OS44NDoxNTQ1OTY1NTQyOjgzODMxMTY0MDkyNDY2NjQ5Nzg&partseq=0"
python示例
import requests
url = "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?method=upload&access_token=xxx&path=/apps/test/test.jpg&type=tmpfile&uploadid=N1-NjEuMTM1LjE2OS44NDoxNTk2MTExNTczOjQ5MTMzMjgwNjk3MDYxODg3MzQ=&partseq=0"
payload = {}
files = [
('file', open('/storage/test.jpg','rb'))
]
headers = {
}
response = requests.request("POST", url, headers=headers, data = payload, files = files)
print(response.text.encode('utf8'))
|
|