commit a5fe45c7ef4bcfd09c9653826a423de0519a6d4d Author: Arturo Filastò art@fuffa.org Date: Thu Apr 11 12:15:28 2013 +0200
Pass the IP address of the probe instead of an object --- ooni/nettest.py | 4 ++-- ooni/utils/geodata.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ooni/nettest.py b/ooni/nettest.py index 0260ca2..41d7f9f 100644 --- a/ooni/nettest.py +++ b/ooni/nettest.py @@ -7,7 +7,7 @@ from twisted.python import usage, reflect
from ooni import geoip from ooni.tasks import Measurement -from ooni.utils import log, checkForRoot +from ooni.utils import log, checkForRoot, geodata from ooni import config from ooni import otime
@@ -40,7 +40,7 @@ class NetTestLoader(object): config.privacy.includecity): log.msg("We will include some geo data in the report") try: - client_geodata = geodata.IPToLocation(config.probe_ip) + client_geodata = geodata.IPToLocation(config.probe_ip.address) except e.GeoIPDataFilesNotFound: log.err("Unable to find the geoip data files") client_geodata = {'city': None, 'countrycode': None, 'asn': None} diff --git a/ooni/utils/geodata.py b/ooni/utils/geodata.py index 56ce05c..2acfdb0 100644 --- a/ooni/utils/geodata.py +++ b/ooni/utils/geodata.py @@ -14,6 +14,7 @@ except ImportError: log.err("Unable to import pygeoip. We will not be able to run geo IP related measurements")
def IPToLocation(ipaddr): + log.debug("looking up %s" % ipaddr) city_file = os.path.join(config.advanced.geoip_data_dir, 'GeoLiteCity.dat') country_file = os.path.join(config.advanced.geoip_data_dir, 'GeoIP.dat') asn_file = os.path.join(config.advanced.geoip_data_dir, 'GeoIPASNum.dat')