This is the goal of post request I need in python:
I got XML file, url and authentication-token. Depending on the xml file I get the xml response from the server back.
req = requests.post(url='http://abc123.com/index.php/plan/', \
headers={'auth-token': 'abCdeFgh'}, \
data={'data': open('sample_plan.xml', 'rb')})
Post request status code is 200, but there is error in xml response like "<error>invalid XML for request</error>
". Supposedly that xml file is filled in wrong parameter in my post request.
But in another tool - Postman - https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en? it works and succeeds with the correct xml response. What I have in Postman:
in Headers: Key: Auth-token Value: abCdeFgh
in Body: form-data option chosen.. Key: data Value: sample_plan.xml file chosen..
Goal for parameters (all parameters are mandatory) of post request: 1. in header - Authentication-Token 2. in body - XML file with name/contentID = data
Which parameter should I put the file of the post request into? I've tried almost everything - based on python-requests documentation...
Thanks for your help!