我正在尝试使用--form数据为Python转换curl调用
curl -H "X-API-TOKEN:xxxxxxxxxxxxxxxxxxxxxxxxxx" -X POST \
--form upload=@2015-07-02-Fiesta-EK-malware-payload.exe \
--form "owner=userName" https://192.168.1.198/rapi/samples/basic
我尝试过:
url = 'https://%s/rapi/samples/basic' % hostname
q = Request(url)
q.add_header('X-API-TOKEN', 'xxxxxxxxxxxxxxxxxxxxxxxxxx')
q.add_header('Content-Type', 'multipart/form-data; upload=@%s' % fileName)
q.add_header('Content-Type', 'multipart/form-data; owner=userName')
a = urlopen(q).read()
我得到的回报是所有提交样本的默认列表。所以我确信它没有得到所有标题数据。
我可以使用传递多个表单数据头的示例。
感谢。
答案 0 :(得分:0)
使用unirest进行示例调用
angular.module('myApp', ['ngRoute', 'appRoutes', 'MainCtrl', 'BlogCtrl', 'BlogService']);
您可以查看此博客了解更多详情http://stackandqueue.com/?p=57