http://wwwsearch.sourceforge.net/ClientForm/

http://wwwsearch.sourceforge.net/Cli...ME-0_1_8b.html

Second (and last, I hope) beta release of 0.1.x.

Changes from 0.1.7a to 0.1.8b:
* Interface change (sorry): id is now directly supported. Controls have
an id attribute, and appropriate HTMLForm methods have an id argument.
This will only affect code that uses the positional arguments that come
after the 'kind' argument of the various HTMLForm methods.
* Interface change: BUTTON/BUTTON now has type "buttonbutton" (was
"button") to prevent clash with type of INPUT/BUTTON (was and is
"button"). Both types of control are ignored anyway (ie. represented
by IgnoreControl), so it's unlikely any code is affected.
* SubmitButton value now defaults to "", so it is successful even when no
value is given in the HTML.
* File upload bugs fixed.
* Minor bug fixes.


Requires Python >= 1.5.2.

ClientForm is a Python module for handling HTML forms on the client
side, useful for parsing HTML forms, filling them in and returning the
completed forms to the server. It has developed from a port of Gisle
Aas' Perl module HTML::Form, from the libwww-perl library, but the
interface is not the same.

Simple example:

from urllib2 import urlopen
from ClientForm import ParseResponse

forms = ParseResponse(urlopen("http://www.acme.com/form.html"))
form = forms[0]
print form
form["author"] = "Gisle Aas"

# form.click returns a urllib2.Request object
# (see HTMLForm.click_request_data.__doc__ if you're not using urllib2)
response = urlopen(form.click("Thanks"))


John