ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-tutor
python-tutor
Re: [Tutor] Fill in a web form
by Michael Janssen other posts by this author
Mar 18 2006 9:09AM messages near this date
Re: [Tutor] Fill in a web form | [Tutor] using cmd
On 3/18/06, David Holland <davholla2002@[...].uk>  wrote:

>  Is there a way in python to automatically put values in a web page ?  For
>  example I used to travel on a train (I live in the UK) that is always late.
>  Is there a way to automatically to do this ?
>  I can't think of  how to do it.

You don't "fill" the form fields, but rather you perform the same
action the browser would performs with a filled form.

You must look into the html-form-tag and its action- and
method-attributes. "Action" is the url to the script receiving the
filled form. Method tells the browser how to send the data: "get"
means to generate an url like "www.google.com?q=python', ie an url
with the content of the form. Method "post" means to send the data
"inline". urllib2.urlopen handles this (its data parameter for "post"
data). Perhaps urllib.urlencode is of interest for you (before
generating a get-url, urlencode the data, so that it renders a sane
url).

This answere is a bit short and might leaves you with a lot of open
questions. If so, ask :-)

regards
Michael
_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
David Holland
Kent Johnson
Alan Gauld
Michael Janssen

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved