I am trying to convert a curl call with --form data for Python
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
What I have tried:
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()
The return I get is the default listing of all submitted samples. So I am sure it is not getting all the header data.
I could use an example of passing multiple form data headers.
Thanks.