automatic form filling

2005-07-12 Thread ulrice jardin
hi,

I would like to know how I could automatically fill a
(search) form on a web page and download the resulting
html page. More precisely I would like to make a
program that would automatically fill the "Buscador
lista 40" (in spanish, sorry) form in the following
webpage:
http://www.los40.com/actualidad/listas/lista40.html
and download the results for several dates
(dia/mes/año = day/month/year).
I am not sure this is the right place to ask, but I
would be very grateful if anybody can help or redirect
me to another mailing list...
thx
jul

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: automatic form filling

2005-07-12 Thread harold fellermann
> I would like to know how I could automatically fill a
> (search) form on a web page and download the resulting
> html page. More precisely I would like to make a
> program that would automatically fill the "Buscador
> lista 40" (in spanish, sorry) form in the following
> webpage:
> http://www.los40.com/actualidad/listas/lista40.html
> and download the results for several dates
> (dia/mes/año = day/month/year).
> I am not sure this is the right place to ask, but I
> would be very grateful if anybody can help or redirect
> me to another mailing list...


The relevant part of the sites source code is the following:












from the first line you can see that submitting the result will request 
the
page "busquedas_b.html" -- so your script has to request this site 
directly
with the form parameters given as additional data (method="POST"). which
form parameters to pass can be seen in the name attributes of the 
input-tags,
e.g. .

urllib provides the methods urlopen and urlencode to setup the query 
string
and fetch the result:

from urllib import urlopen,urlencode

form_data = {
'byDay' : '12' ,
'byMonth' : '07' ,
'byYear' : '2005'
}
html_data = urlopen(
"http://www.los40.com/actualidad/listas/busquedas_b.html";,
urlencode(form_data)
).read()

print html_data


- harold -

--
"I know what I believe. I will continue to articulate what I believe
  and what I believe - I believe what I believe is right."
-- George W. Bushman

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: automatic form filling

2005-07-12 Thread Daniel Dittmar
> I would like to know how I could automatically fill a
> (search) form on a web page and download the resulting
> html page. 

http://wwwsearch.sourceforge.net/ClientForm/


Daniel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: automatic form filling

2005-07-12 Thread ulrice jardin
Thanks A LOT for your help!

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list