Fix reading of emails archives
Change-Id: I3a04877f19a06bb641b1b6dc3b82c0414de56c55
This commit is contained in:
@@ -89,7 +89,7 @@ def check_email_validity(email):
|
|||||||
def read_uri(uri):
|
def read_uri(uri):
|
||||||
try:
|
try:
|
||||||
fd = six.moves.urllib.request.urlopen(uri)
|
fd = six.moves.urllib.request.urlopen(uri)
|
||||||
raw = fd.read().decode('utf8')
|
raw = fd.read()
|
||||||
fd.close()
|
fd.close()
|
||||||
return raw
|
return raw
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -107,9 +107,9 @@ def read_json_from_uri(uri):
|
|||||||
|
|
||||||
def gzip_decompress(content):
|
def gzip_decompress(content):
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
return gzip.decompress(content)
|
return gzip.decompress(content).decode('utf8')
|
||||||
else:
|
else:
|
||||||
gzip_fd = gzip.GzipFile(fileobj=six.moves.StringIO.StringIO(content))
|
gzip_fd = gzip.GzipFile(fileobj=six.moves.StringIO(content))
|
||||||
return gzip_fd.read()
|
return gzip_fd.read()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user