GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Python Wiki
  • PSF Wiki
  • Jython Wiki
  • Python Wiki
  • Archive

This view

  • Original page
  • New address

GeezerVison is showing wiki.python.org — Reading HTML Forms

View as Markdown

Reading HTML Forms¶

Legacy Wiki Page

This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org.

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:

  • Mechanize: http://wwwsearch.sourceforge.net/mechanize/ (which is based on a Perl module)

  • Webunit: http://www.mechanicalcat.net/tech/webunit/


CategoryFaq

Previous
Rdf Libraries
Next
Recipe Template
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.