Re: [Python-de] website formular via applikation füllen und abschicken

Dieter Neubauer neubauer at lni.de
Mon Sep 15 17:26:54 CEST 2003


---------- benny kohler schreibt am Montag, 15. September 2003 15:26:

> wuerde gerne von meiner python applikation aus auf ein formular einer
> webseite zugreiffen, dh. daten sollen ins formular eingetragen werden
> und am ende soll das formular abgeschickt werden(durch bestättigung
> des submit buttons im auf der webseite). kann mir jemand weiterhelfen
> bzw. n tipp geben nach was ich suchen muss.


Schau Dir mal die nachfolgende Mail an, insbesondere das Beispiel am
Ende

Gruß,
Dieter




---------- John J. Lee schreibt am Mittwoch, 13. August 2003 02:14:
> http://wwwsearch.sourceforge.net/ClientForm/
>
> First (and last, I hope) beta release of 0.1.x.
>
> Changes from 0.1.5a to 0.1.7b:
>  * After some thought about Law of Demeter, realised that there was no
>    justification for deprecating most use of find_control, nor for
>    adding many of the new methods on HTMLForm.  Use of find_control
>    is now officially OK again.  set_/get_readonly, set_/get_disabled,
>    set_/get_item_disabled, set_all_items_disabled have been removed
>    from HTMLForm.
>  * Added HTMLForm.set_all_readonly method.  This one is actually
> useful!
>  * possible_label_items is gone, replaced by by_label argument to
>    possible_items.  by_label is now as consistent as possible.  The
>    exceptions are set_value_by_label and get_value_by_label, since
>    there is no method to add an argument to in those cases.  The lack
>    of implementation of by_label for CHECKBOX and RADIO is considered
>    a bug, so NotImplementedError is raised.  LabelNotSupportedError
>  has gone. * Added indication to ListControl.str of disabled
>    items -- they have parentheses around them: item 1, (item 2), item
>    3 means "item 2" is disabled.
>  * Bug fixes.
>
>
> 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.
>
> Simple example:
>
>  from urllib2 import urlopen
>  from ClientForm import ParseResponse
>
>  forms = ParseResponse(urlopen("http://www.acme.com/form.html"))
>  form = forms[0]
>  print form
>  form["author"] = "Gisle Aas"
>
>  # form.click returns a urllib2.Request object
>  # (see HTMLForm.click_request_data.doc if you're not using
>  urllib2) response = urlopen(form.click("Thanks"))
>
>
> John