How can I get the content of a web site using http library

silverburgh.meryl at gmail.com silverburgh.meryl at gmail.com
Thu Mar 29 15:49:55 EDT 2007


On Mar 29, 2:34 pm, kyoso... at gmail.com wrote:
> On Mar 29, 2:18 pm, "silverburgh.me... at gmail.com"
>
>
>
> <silverburgh.me... at gmail.com> wrote:
> > I am trying to get the content of a web site like this:
> > But my question is how can I do a 'GET' request without putting the '/
> > index.html''
>
> >    h = httplib.HTTP('www.yahoo.com')
>
> >         # it takes 2 arguments here, but I don't know if the site has
> > '/index.html' , how can I leave this out?
>
> >         h.putrequest('GET')
> >         h.endheaders()
>
> >         errcode, errmsg, headers = h.getreply()
>
> >         if (errcode == 200):
>
> >             f = h.getfile()
>
> > Thank you for your help.
>
> You may want to go with the urllib module instead. Check out the how-
> to below:
>
> http://www.voidspace.org.uk/python/articles/urllib2.shtml
>
> Mike

Thanks. Can you please tell me how can I do a Post form submission
using the urlLib2 library? I look at your link, but i cant find an
example there.

Thank you.




More information about the Python-list mailing list