urlretrieve get file name

Sven sven.dahlstrand at gmail.com
Fri Nov 10 14:58:22 EST 2006


Yes the browser suggests a file name, but I did a little research using
http://web-sniffer.net/. The Response Header contains roughly this:

HTTP Status Code: HTTP/1.1 302 Found
Location: http://page.com/filename.zip
Content-Length: 0
Connection: close
Content-Type: text/html

The status code 302 tells the browser where to find the file. The funny
thing is that calling the info() function, on the file-like response
object, in Python doesn't return the same header. I'm so stuck. :-)
Thanks for your help.

On 10 Nov, 01:27, Gabriel Genellina <gagsl... at yahoo.com.ar> wrote:
> At Thursday 9/11/2006 20:52, Sven wrote:
>
> >Thanks for your help, but I'm a guy with no luck. :-) I can't get the
> >file name from response header...Try using a browser and "Save as..."; if it suggests a file name, it
> *must* be in the headers - so look again carefully.
> If it does not suggests a filen ame, the server is not providing one
> (there is no obligation to do so).
>
> --
> Gabriel Genellina
> Softlab SRL
>
> __________________________________________________
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
> ¡Abrí tu cuenta ya! -http://correo.yahoo.com.ar




More information about the Python-list mailing list