I'm trying to submit a form using (requests) module.
Here is the form that I want to submit:
<form method="POST" enctype="multipart/form-data" action="/cgi-bin/claws72.pl"> <input type="hidden" name="email" value="[email protected]"><br> <br> Select tagset: <input type="radio" name="tagset" value="c5" checked=""> C5 <input type="radio" name="tagset" value="c7"> C7 <br><br> Select output style: <input type="radio" name="style" value="horiz" checked=""> Horizontal <input type="radio" name="style" value="vert"> Vertical <input type="radio" name="style" value="xml"> Pseudo-XML <br><br> <textarea name="text" rows="10" cols="50" wrap="virtual">Type (or paste) your text to be tagged into this box. </textarea> <br> <input type="SUBMIT" value="Tag text now"> <input type="reset" value="Reset form"> </form> This is the website that contains this form: http://ucrel.lancs.ac.uk/claws/trial.html
Here is my code:
import requests data = {'email' : '[email protected]', 'tagset':'c7', 'style' : 'xml', 'text' : 'TEST' } r = requests.post('http://ucrel.lancs.ac.uk/cgi-bin/claws72.pl', data=data) print(r.text) #0 words tagged (Why? it should tag the (TEST) word) print(r.ok) #True I use the same code with my own website form and it works, but can't figure out why it doesn't do so here! Do you think the website itself block such requests?
Thanks
r.content?