The url that i have to submit to the server looks like this:
www.mysite.com/manager.php?checkbox%5B%5D=5&checkbox%5B%5D=4&checkbox%5B%5D=57&self=19&submit=Go%21
The post data I put it like this:
data = {'checkbox%5B%5D': '4', ....and so on... 'self': '19', 'submit': 'Go%21'}
I encode it:
data = urllib.urlencode(orbs)
and this is how i run it:
resp = mechanize.Request('http://mysite.com/manager.php', data)
cj.add_cookie_header(resp)
res = mechanize.urlopen(resp)
print res.read()
And the error says: That i didnt select any item. How can I do it right without using br.select_form(nr=0) because I have nested forms? Thanks.
You double-encoded the checkbox field names; you should use checkbox[]
instead of checkbox%5B%5D
. Also, because that key name is reused, you probably can't use a dictionary to gather up the arguments.