Hi,
Just a patch for Anand's solution using httplib :)
import httplib
conn = httplib.HTTPConnection(host)
conn.request('HEAD', path)
print conn.getresponse().getheader('Content-Length')
5c5
< print conn.getresponse().getheader('Content-Type')
---
> print conn.getresponse().getheader('Content-Length')
When I tried this script,
>>> conn =
httplib.HTTPConnection('www.visitingdc.com')
>>>
conn.request('HEAD','/images/la-brea-tar-pits-address.jpg')
>>> print
conn.getresponse().getheader('Content-Length')
123762
It shows this number ie 123.762K. I have downloaded
this picture and in my system, when I checked it, it's
size is 132k
ie
du --si la-brea-tar-pits-address.jpg
132k la-brea-tar-pits-address.jpg
It seems to me like a mismatch between the actual size
and the value obtained from the Content-Length. But
how this happenned ?
Regards,
Maxin B. John
__________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers