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:18:19 EDT 2007


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.




More information about the Python-list mailing list