[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Make the geoip lookup more robust
commit 2a9e471250cebcbe6422a79e293d03d4d7b3d195
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date: Fri Apr 28 16:01:45 2017 +0000
Make the geoip lookup more robust
related to #751
---
ooni/common/http_utils.py | 2 ++
ooni/geoip.py | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/ooni/common/http_utils.py b/ooni/common/http_utils.py
index b44f5c0b..f54341c1 100644
--- a/ooni/common/http_utils.py
+++ b/ooni/common/http_utils.py
@@ -5,6 +5,8 @@ from base64 import b64encode
def representBody(body):
if not body:
return body
+ if isinstance(body, unicode):
+ return body
try:
body = unicode(body, 'utf-8')
except UnicodeDecodeError:
diff --git a/ooni/geoip.py b/ooni/geoip.py
index eda814e3..bb983eca 100644
--- a/ooni/geoip.py
+++ b/ooni/geoip.py
@@ -264,7 +264,7 @@ class ProbeIP(object):
@d.addCallback
def cb(result):
self.strategy = 'tor_get_info_address'
- self.address = result.values()[0]
+ self.address = str(result.values()[0])
return d
else:
raise errors.TorStateNotFound
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits