$ curl -F myfile=@myfilename -F 'data={"title":"some title","otherinfo" : "aabcdef"}' https://someurl
以上是从终端做的工作和正确的方法。
我尝试以这种方式使用请求在python中实现这一点:
files = {'myfile': open('myfilename', 'rb')}
data = {}
data['data'] = {
'title' : 'some title',
'otherinfo' : 'other info'
}
r = requests.post(url, files=files, data=data, auth=auth)
在这里,数据没有正确到达目的地,我哪里错了?