python and http POST

galileo228 mattbarkan at
Thu Feb 11 20:11:51 CET 2010

Hey All,

Been teaching myself Python for a few weeks, and am trying to write a
program that will go to a url, enter a string in one of the search
fields, submit the search, and return the contents of the search

I'm using httplib2.

My two particular questions:

1) When I set my 'body' var, (i.e. 'body = {'query':'search_term'}),
how do I know what the particular key should be? In other words, how
do I tell python which form on the web page I'm visiting I'd like to
fill in? Do I simply go to the webpage itself and look at the html
source? But if that's the case, which tag tells me the name of the

2) Even once python fills in the form properly, how can I tell it to
'submit' the search?

Thanks all!


More information about the Python-list mailing list