RELEASE: ClientForm 0.0.5
jjl@pobox.com
jjl@pobox.com
Thu, 6 Feb 2003 15:27:50 +0000
http://wwwsearch.sourceforge.net/ClientForm/
Changes since 0.0.4b:
* First stable release.
* Parser now no longer reads entire file before starting to work on
data.
* Implemented ISINDEX submission, and updated documentation (see
IsindexControl.__doc__).
* Changed type attributes of BUTTON TYPE=SUBMIT and BUTTON TYPE=RESET
to "submitbutton" and "resetbutton" respectively. Previously, they
were "submit" and "reset" respectively, which made it impossible to
tell whether they came from a BUTTON or an INPUT control.
* Minor documentation improvements.
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.
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
John