[BangPypers] How to check file size before downloading it
anandology at gmail.com
Wed May 7 13:50:03 CEST 2008
On Wed, May 7, 2008 at 4:49 PM, Gurpreet Sachdeva
<gurpreet.sachdeva at gmail.com> wrote:
> Is there a way in urllib to check file size (from the webserver) before
> downloading it? Or any other python module from this?
If you are on *nix, you can use curl -I to make a HEAD request, which
contains Content-Length header.
$ curl -I http://www.google.com/favicon.ico
HTTP/1.1 200 OK
Last-Modified: Wed, 07 Jun 2006 19:35:34 GMT
Expires: Sun, 17 Jan 2038 19:14:07 GMT
Date: Wed, 07 May 2008 11:45:57 GMT
More information about the BangPypers