Checkbox input in python urllib -


how can check checkbox if html code looks like:

<input type="checkbox" name="tos_understood" style="background:none; border:none" /> 

so, python code is:

import urllib import urllib2 import cookielib  authentication_url = 'http://test.com'  # input parameters going send payload = {   'user': 'newuser',   'pass': '12345'   'tos_understood': ??????????   }  # use urllib encode payload data = urllib.urlencode(payload)  # build our request object req = urllib2.request(authentication_url, data) print req  # make request , read response resp = urllib2.urlopen(req) contents = resp.read() print contents 

what should write in tos_understood section? there no way login without checked checkbox.

this should work:

payload = {   'user': 'newuser',   'pass': '12345',   'tos_understood': 'on',   } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -