I need to create a funcion that will send xml with post request and receives it back in python. On the official site (only available in Czech) there is only this little code of html form:
<form name="frmdata" method="post" enctype="multipart/form-data"
action="http://www.rzp.cz/cgi-bin/aps_cacheWEB.sh">
<input type="hidden" name="VSS_SERV" value="ZVWSBJXML">
<input type="file" name="filename">
<input type="submit" name="x" value="ODESLI">
</form>
So I am trying to convert it like this to python, for automatization, but it is not working:
headers = {'Content-Type':'text/xml'}
url = 'http://www.rzp.cz/cgi-bin/aps_cacheWEB.sh'
with open('dotaz1.txt') as xml:
myobj = { 'VSS_SERV': 'ZVWSBJXML',
'X': 'ODESLI',
'file': xml,
}
x = requests.post(url, data = myobj, headers=headers)
Does somebody know what I am doing wrong?