Hi, Jean I've alredy tried this, but it seems that this kind of code just works when "file" in the url (http://www.somesite.com/file) is an html file. The thing is that "file" in this case is a text file. For example: if I try to download the file using a web browser, it asks me for a directory to save the file. Do you have any other idea?
Thanks. Jean-Philippe Durand wrote: > Hello Ronaldo, > Try this : > import urllib > > mysock = urllib.urlopen("http://www.somesite.com/file") > > htmlSource = mysock.read() > mysock.close() > > print htmlSource > Regards. > Jean-Philippe DURAND > > > 2007/3/13, [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>: > > Hello all, > > How can I download a file using HTTP? > For example: > There is a file at: http://www.somesite.com/file. I need to get > this file using HTTP from a python script. > I'm not sure but I think httplib could be used to do that. > Can anyone confirm that? or Can anyone suggest me something else? > > Thank you? > > -- > Ronaldo Z. Afonso > Phone: 55+11+82619082 > www.netf2r.com <http://www.netf2r.com> > _______________________________________________ > Tutor maillist - Tutor@python.org <mailto:Tutor@python.org> > http://mail.python.org/mailman/listinfo/tutor > <http://mail.python.org/mailman/listinfo/tutor> > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor