Re: [Tutor] HTTP file download

2007-03-14 Thread Ronaldo
Hi Kent, You were right. The code worked fine. I was doing some thing wrong with some characters in my URL (for example: I had to change "&" to "&"). I'd like to thank you guys for your help. Kent Johnson wrote: > Ronaldo wrote: >> Hi, Jean >> >> I've alredy tried this, but it seems

Re: [Tutor] HTTP file download

2007-03-14 Thread Jean-Philippe Durand
Hi Ronaldo, Yes the first solution works with html files. This is how to download a file found on the web : import urllib urllib.urlretrieve('http://www.somesite.com/file', 'c:/mylocalfile') Regards. Jean-Philippe DURAND 2007/3/14, Ronaldo <[EMAIL PROTECTED]>: > Hi, Jean > > I've alredy tri

Re: [Tutor] HTTP file download

2007-03-14 Thread Sönmez Kartal
Hi, Socket downloads the output of given URL. You can get the file's extension by URL and save it as a file with it's extension. Sönmez Ronaldo wrote: > 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/fil

Re: [Tutor] HTTP file download

2007-03-14 Thread Jason Massey
I've tested this on my Apache server setup, it succesfully downloads the gif file and the text file and saves them. Even though I used the 'wb' flag (write binary) for the text file it turned out okay (the difference in 'w' and 'wb' seemed to be that 'wb' stripped off some of my blank lines). On

Re: [Tutor] HTTP file download

2007-03-14 Thread Kent Johnson
Ronaldo wrote: > 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

Re: [Tutor] HTTP file download

2007-03-14 Thread Ronaldo
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 director

Re: [Tutor] HTTP file download

2007-03-13 Thread Tony Cappellini
How do you handle a binary file? Message: 4 Date: Tue, 13 Mar 2007 13:23:44 +0100 From: "Jean-Philippe Durand" <[EMAIL PROTECTED]> Subject: Re: [Tutor] HTTP file download To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> Cc: tutor@python.org Message-ID: <[E

Re: [Tutor] HTTP file download

2007-03-13 Thread Jean-Philippe Durand
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] <[EMAIL PROTECTED]>: Hello all, How can I download a file using HTTP? For ex

[Tutor] HTTP file download

2007-03-13 Thread ronaldo
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? Th