RELEASE: ClientForm 0.0.3b

John J. Lee jjl@pobox.com
Fri, 25 Oct 2002 14:36:59 +0100


ClientForm 0.0.3b

This is a beta release (the first, and probably the last).

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

Changes since 0.0.2a:
 -Too many to list!
 -It works, unlike the alpha release.
 -Backported to 1.5.2.
 -Added TEXTAREA.
 -Many small improvements to the interface.
 -All HTML attributes are now accessible.
 -Interface is in terms of controls rather than items/inputs.
 -Disabled and readonly HTML attributes are now reflected in control
  interfaces.
 -Netscape / IE behaviour for default value of multiple-selection SELECT
  controls is now the default.  RFC 1866 behaviour is still available.
 -Many bugs fixed.
 -Improved tests and documentation.
 -Much smaller package, thanks to removing an excessively large test file.

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 is a port (more-or-less) of Gisle
Aas' Perl module HTML::Form, from the libwww-perl library.

 import ClientForm
 import urllib2
 request = urllib2.Request("http://www.acme.com/form.html")
 response = urllib2.urlopen(request)
 forms = ClientForm.ParseResponse(response)
 form = forms[0]
 form["cheeses"] = ["parmesan", "leicester", "cheddar"]
 form.toggle("cheeses", "gorgonzola")
 form["author"] = "Gisle Aas"
 request2 = form.click("Thanks")
 response2 = urllib2.urlopen(request2)

 print response2.geturl()
 print response2.info()  # headers
 for line in response2.readlines():  # body
     print line

All of the standard input types are supported: TEXT, PASSWORD, HIDDEN,
TEXTAREA, RESET, BUTTON, SUBMIT, IMAGE, RADIO, CHECKBOX and
SELECT/OPTION.  FILE (for file upload) is not yet supported, but will
be in a future version.

Python 1.5.2 or above is required.  To run the tests, you need the
unittest module (from PyUnit, and a standard library module with
Python 2.1 and above).


John