Download file from web site

Peter Hansen peter at engcorp.com
Tue Dec 4 02:30:36 EST 2001


Thomas Pham wrote:
> 
> I am trying to download a file from a website.   My source 
> code is listed below.    But I can only get to its first page.   
> I could not go further to its second page.    The second page 
> "idm_download" however, does require an user ID & password to 
> open it.
> 
> #!/usr/local/bin/python
> import httplib
> h = httplib.HTTP('www.teamidm.com/idm_download/')
> h.putrequest('GET', '/index.html')

I can't help with the userid/password part, but it looks
to me like the above is asking for the index.html file
that is in the root folder.  You are using an absolute
path for the GET, with a leading slash.  If you want
to get idm_download/index.html, you probably don't
want to use "/index.html" to get it, but "index.html".
(But I could be all wet on this.)

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list