Skip to content Skip to sidebar Skip to footer

Corrupt Zip Download Urllib2

I am trying to download zip files from measuredhs.com using the following code: url ='https://dhsprogram.com/customcf/legacy/data/download_dataset.cfm?Filename=BFBR62DT.ZIP&Tp=

Solution 1:

Try writing to local file in binary mode.

with open('install.zip', 'wb') as output:
    output.write(request.read())

Also, comparing the md5/sha1 hash of the downloaded file will let you know if the downloaded file has been corrupted.

Post a Comment for "Corrupt Zip Download Urllib2"