Fix reading of emails archives

Change-Id: I3a04877f19a06bb641b1b6dc3b82c0414de56c55
This commit is contained in:
Ilya Shakhat
2014-08-13 15:47:57 +04:00
parent 6e7d66900c
commit e61336c2a3

View File

@@ -89,7 +89,7 @@ def check_email_validity(email):
def read_uri(uri):
try:
fd = six.moves.urllib.request.urlopen(uri)
raw = fd.read().decode('utf8')
raw = fd.read()
fd.close()
return raw
except Exception as e:
@@ -107,9 +107,9 @@ def read_json_from_uri(uri):
def gzip_decompress(content):
if six.PY3:
return gzip.decompress(content)
return gzip.decompress(content).decode('utf8')
else:
gzip_fd = gzip.GzipFile(fileobj=six.moves.StringIO.StringIO(content))
gzip_fd = gzip.GzipFile(fileobj=six.moves.StringIO(content))
return gzip_fd.read()