[PEAK] Downloading via redirection

Yang qp10sxo02 at sneakemail.com
Sat Mar 24 00:20:29 EDT 2007


On 3/23/07, Phillip J. Eby pje-at-telecommunity.com |python-peak|
<...> wrote:
> At 08:58 PM 3/23/2007 -0400, Yang wrote:
> >But when easy_install requests
> >http://assorted.sf.net/python-commons/download/ (which it apparently
> >does, based on the output), won't the HTTP response inform it of the
> >filename and type (and thus it can see that it's downloading
> >python-commons-0.1.tar.gz)?
>
> No, because when it follows a home page or download link, it's looking for
> an HTML page that it can find download URLs on -- not the actual download
> file.  At that point, it hasn't chosen *which* URL is the best match for
> your criteria, so it's not expecting to download anything yet, only to look
> at web pages for *links* to downloads.

So why not simply check (once you're fetching the download-URL)
whether it's a web page, as you normally expect (text/html), or
whether it's in fact a tar.gz (or other acceptable filetype)?



More information about the PEAK mailing list