At Friday 10/11/2006 16:58, Sven wrote:
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.
Because urlopen is smart enough to detect the redirection and do a
second request.
You can use the geturl() method to obtain the true URL used (that
would be http://page.com/filename.zip) and then rename the file.
Or, you can install your own URLOpener (I think a FancyURLOpener with
retries=0 would be OK) and process the Location header yourself. See
the urllib documentation.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
--
http://mail.python.org/mailman/listinfo/python-list