在python请求中寻找低于curl的值
curl -k --cookie "<cookie>" -H "Content-Type: application/octet-stream" --request PUT 'https://<url>' -F file=@<file path> -F filename=<file name>
尝试以下
upload_file = "/some_file.txt"
HEADERS = {'Content-type': 'application/octet-stream'}
files = {'file': open(upload_file, 'rb')}
cookies = req.cookies
response = session.put(url, files=files, cookies=cookies,
headers=HEADERS)
请求还可以,但是我在json响应中从服务器收到文件验证错误。看起来文件未按预期上传。相同的文件可以在curl下正常工作。