Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2004-06-03 07:39:12
Size: 778
Editor: dsl254-010-130
Comment: Is there Python code out there to read HTML <FORM>s, and respond to them?
Revision 5 as of 2008-11-15 13:59:48
Size: 1087
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
-- LionKimbro [[DateTime(2004-06-03T07:39:12Z)]] -- StefanBehnel

[[http://codespeak.net/lxml/lxmlhtml.html#forms|lxml.html]] has pretty sophisticated HTML form support.

-- LionKimbro <<DateTime(2004-06-03T07:39:12Z)>>

Look at:

 * Mechanize: http://wwwsearch.sourceforge.net/mechanize/ (which is based on a Perl module)
 * Webunit: http://www.mechanicalcat.net/tech/webunit/
----
CategoryFaq

A friend of mine recently asked, "Is there anything in Python that can read forms?

He's got perl code that looks like this:

        my $form = HTML::Form->parse($writeFormPage, $res->base());
        defined($form) or return "Can't even get wiki edit form at $URL";
    if ($form->find_input('savetext')) {
        $form->value('savetext',$pagetext);
    }
        my $req = $form->click('button_save');
        my $res = $ua->request($req);

I thought, "cgi module," but realized it's for writing pages, not reading them. Then I thought urllib, but didn't see anything very promising over there, either.

Does anyone know of Python code or a Python module that will help you read out forms, and create responses to them?

-- StefanBehnel

lxml.html has pretty sophisticated HTML form support.

-- LionKimbro 2004-06-03 07:39:12

Look at:


CategoryFaq

ReadingHtmlForms (last edited 2011-02-26 09:55:58 by StefanBehnel)

Unable to edit the page? See the FrontPage for instructions.