Changes since 0.0.5: * Empty TEXTAREA case fixed. * Exception is no longer raised for INPUT TYPE=FILE -- instead, FILE controls are just ignored (they will be handled properly in 0.1.x). * Documentation improvements to web page (note that the web page is more up to date than the copy of same in the package -- sorry).
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.
from urllib2 import urlopen from ClientForm import ParseResponse
forms = ParseResponse(urlopen("http://www.acme.com/form.html")) first_form = forms form["author"] = "Gisle Aas"
# form.click returns a urllib2.Request object # (use the items argument to this method if you're not using urllib2) response = urlopen(form.click("Thanks"))
John J Lee