Size of a remote URL

Justin justin__devine at hotmail.com
Mon Aug 30 13:43:21 EDT 2004


Ok.  I believe you are correct.  I have observed the two MODES of the
download dialog box.  HOWEVER there are still some instances in which
Internet Explorer knows the size of something that my code cannot
determine.  So now I have this conclusion:  The instances where I
cannot get the size but a browser can must exist because I am not
asking the server the right question.  Perhaps "Content-Length" is not
included in the default headers, but the server will provide this
header if it is asked too?  Maybe I need to ask for that header more
specifically?  Also do you know of a simpler method than urlopen? I am
unsure if urlopen actually reads the file all the way through once.  If
so this is a huge waste of resources for me and I will try to
incorporate this code directly into my download funciton so that as
each file is downloaded its size is passed to the dialog box.  Let me
know what you think.  Thanks

-Justin

let me past my simple code:

file_sizes = []

for y in linklisttype:
w = urlopen(y)
z = w.info()
x = z.getheader("Content-Length")
file_sizes.append(x)




More information about the Python-list mailing list