I building a simple downloader application in python using urllib2.
now i have a major problem with urllib2.
i used this type of the code:
i think my code was correct, But urllib2 giving empty output ("") in the middle of the file.PHP Code:
connection = urllib2.urlopen("http://softwareroxer.110mb.com/apps/rdm/rdm0.9-1alpha.deb.zip")
rec_size = 0
fsize = connection.headers(["Content-Length"])
Out = connection.read(5*1024) #5kb buffer
rec_size = len(Out)+rec_size
if rec_size == fsize:
print "File size matched"
elif Out == "":
print "Empty output...."
I have also tried with httplib, but the same error occurred.
i am using threads for this connections.
whats wrong with urllib or my code, I can't get any ideas about this ,
please help me friends.
thanks in advance.