import sys
import tempfile
import urllib2
+import zipfile
+import StringIO
# Project Settings
BASEDIR_PATH = os.path.dirname(os.path.realpath(__file__))
continue;
print 'Updating source ' + source + ' from ' + updateURL
updatedFile = urllib2.urlopen(updateURL)
+
updatedFile = updatedFile.read()
+
+ if '.zip' in updateURL:
+ updatedZippedFile = zipfile.ZipFile(StringIO.StringIO(updatedFile))
+ for name in updatedZippedFile.namelist():
+ if name in ('hosts', 'hosts.txt'):
+ updatedFile = updatedZippedFile.open(name).read()
+ break
+
updatedFile = string.replace( updatedFile, '\r', '' ) #get rid of carriage-return symbols
dataFile = open(DATA_PATH + '/' + source + '/' + DATA_FILENAMES, 'w')