Hi, On Monday 27 June 2005 12:10, Oyvind Ostlund wrote: > I have to download a lot of files. And at the moment i am trying with > URLLib. But sometimes it doesn't download the whole file. It looks like it > stops half way through or something. Is it possible to ask for the file > size before you download, and then test afterwards if the whole file was > read? If so please guid me a bit here.
You need something like that:
import urllib2
URI='http://cekirdek.uludag.org.tr/index.html'
file = urllib2.urlopen(URI)
headers = file.info()
fsize = int(headers['Content-Length'])
HTH..
Ciao,
--
- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
A. Murat Eren
meren at uludag.org.tr
http://cekirdek.uludag.org.tr/~meren/
0x527D7293,
7BCD A5A1 8101 0F6D 84A4 BD11 FE46 2B92 527D 7293
- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
--
Alan Cox sounds as if he hasn't followed the
development of programming languages
and compilers for the last 10 years (exa).
-
pgpeIV7ukCgFH.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list
