VERY basic browser question

Cameron Laird claird at lairds.com
Mon Feb 24 08:31:13 EST 2003


In article <mailman.1046026804.9881.python-list at python.org>,
 <cribeiro at mail.inet.com.br> wrote:
			.
		[detailed and valu-
		able true stuff]
			.
			.
>3) The 'smart browser' approach.
>
>Another approach is to implement your own automated browser object. This
>is relatively easy in Python thanks to urllib and other advanced
>libraries. The basic idea is as follows:
>
>- using the urllib, open the page you want to access;
>- when you get the answer (in plain HTML, or even XML), parse it, and look
>for the form you want to fill in. The form contains all information
>needed: the name of the fields, and also the method to be used (GET or
>POST).
>- build your own http request to send the data as if it were filled in by
>the user. This is not as hard as it may seem. There are two ways to send
>data (GET and POST); it's simply a matter of building the correct request,
>and to send it using http.
>
>This is not as hard as it may seem, specially if you already know in
>advance the field names. Then you can just write the request, and send it.
>In some cases (depending on the web application) you can evenskip the
>first step and send in the filled form; of course, this depends on the
>application being controlled.
>
>I hope my explanation will be helpful. Please forgive any spelling errors
>(or even a few factual ones) - it's Snday, you know, and it's possible
>that a few neurons are still sleeping while I write this.
			.
			.
			.
I'd emphasize to the original poster the "[t]his is
not as hard as it may seem" part.  In practice, many,
MANY of the automations of this sort take only a few
minutes' work.  I encourage the original poster to
explain his precise situation in more detail, if he
still is struggling.
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://phaseit.net/claird/home.html




More information about the Python-list mailing list