python and http POST

Terry Reedy tjreedy at
Fri Feb 12 00:20:16 CET 2010

On 2/11/2010 2:11 PM, galileo228 wrote:
> 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
> result.
> 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
> key?
> 2) Even once python fills in the form properly, how can I tell it to
> 'submit' the search?

*might* help you.

More information about the Python-list mailing list