How to parse form in client side?

Stefan Behnel stefan_ml at behnel.de
Fri Feb 27 10:38:31 EST 2009


Muddy Coder wrote:
> cgi module can easily acquire the all fields of data input from client
> side, through a form. Then, a simple line of code:
> 
> form_dict = cgi.FieldStorage()
> 
> grabs all data into a dictionary form_dict. The rest becomes a piece
> of cake by querying the form_dict. Nice!
> 
> However, it is done in the server side. Now I want to do the same in
> the client side. first of all, I get the source code of a HTML form by
> using urllib, from server, with code below:
> 
> html_source = urllib.urlopen(URL).read()
> 
> Then, I need to parse this html_source file, at client side. Is there
> a module to handle this? Can somebody help? Thanks!

lxml.html has good form handling support:

http://codespeak.net/lxml/lxmlhtml.html#forms

Stefan



More information about the Python-list mailing list