[BangPypers] BangPypers Digest, Vol 9, Issue 7

Maxin B John maxin_john at yahoo.co.uk
Thu May 8 11:38:07 CEST 2008


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


More information about the BangPypers mailing list