Re: [BangPypers] How to check file size before downloading it

2008-05-08 Thread S.Ramaswamy
On Thu, May 8, 2008 at 11:15 AM, Gurpreet Sachdeva <[EMAIL PROTECTED]> wrote: > Yeah thats what I found. Any idea what settings need to be done in the > webserver (Apache) to report content-length header? Or any other > alternative? > > Thanks for your help, > Gurpreet > AFAIK, Apache 2 reports Con

Re: [BangPypers] How to check file size before downloading it

2008-05-07 Thread Anand Balachandran Pillai
On Wed, May 7, 2008 at 5:53 PM, Akash <[EMAIL PROTECTED]> wrote: > On Wed, May 7, 2008 at 5:41 PM, Anand Balachandran Pillai > <[EMAIL PROTECTED]> wrote: > > > Make a HEAD request. Here is one way of doing it, using urllib2. > > Since we are on the subject of urllib2. Any resources you recommend

Re: [BangPypers] How to check file size before downloading it

2008-05-07 Thread Gurpreet Sachdeva
Yeah thats what I found. Any idea what settings need to be done in the webserver (Apache) to report content-length header? Or any other alternative? Thanks for your help, Gurpreet On Wed, May 7, 2008 at 10:19 PM, S.Ramaswamy <[EMAIL PROTECTED]> wrote: > On Wed, May 7, 2008 at 4:49 PM, Gurpreet S

Re: [BangPypers] How to check file size before downloading it

2008-05-07 Thread S.Ramaswamy
On Wed, May 7, 2008 at 4:49 PM, Gurpreet Sachdeva <[EMAIL PROTECTED]> wrote: > Is there a way in urllib to check file size (from the webserver) before > downloading it? Or any other python module from this? > Just a nit. It might be a good idea to check for the existence of the Content-Length head

Re: [BangPypers] How to check file size before downloading it

2008-05-07 Thread Akash
On Wed, May 7, 2008 at 5:41 PM, Anand Balachandran Pillai <[EMAIL PROTECTED]> wrote: > Make a HEAD request. Here is one way of doing it, using urllib2. Since we are on the subject of urllib2. Any resources you recommend other than the standard python docs ? I have referred to this sometimes : htt

Re: [BangPypers] How to check file size before downloading it

2008-05-07 Thread Anand Chitipothu
On Wed, May 7, 2008 at 5:41 PM, Anand Balachandran Pillai <[EMAIL PROTECTED]> wrote: > Make a HEAD request. Here is one way of doing it, using urllib2. > > class HeadRequest(urllib2.Request): > """ A request class which performs a HEAD request """ > > def get_method(self): > return

Re: [BangPypers] How to check file size before downloading it

2008-05-07 Thread Anand Balachandran Pillai
Make a HEAD request. Here is one way of doing it, using urllib2. class HeadRequest(urllib2.Request): """ A request class which performs a HEAD request """ def get_method(self): return 'HEAD' req = HeadRequest(url) f = urllib2.urlopen(req) headers = dict(f.headers) print headers.g

Re: [BangPypers] How to check file size before downloading it

2008-05-07 Thread Anand Chitipothu
On Wed, May 7, 2008 at 4:49 PM, Gurpreet Sachdeva <[EMAIL PROTECTED]> 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-Leng

Re: [BangPypers] How to check file size before downloading it

2008-05-07 Thread Vinayak Hegde
On Wed, May 7, 2008 at 4:49 PM, Gurpreet Sachdeva <[EMAIL PROTECTED]> wrote: > Is there a way in urllib to check file size (from the webserver) before > downloading it? Or any other python module from this? Just do a HEAD http request and check the content-length header of the server's http respon

[BangPypers] How to check file size before downloading it

2008-05-07 Thread Gurpreet Sachdeva
Is there a way in urllib to check file size (from the webserver) before downloading it? Or any other python module from this? Thanks and Regards, Gurpreet Singh ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/ban