From 253e0c9c1816872aa76804527a275eb4992a43a5 Mon Sep 17 00:00:00 2001 From: cgonzalez Date: Tue, 26 Jan 2021 12:09:34 +0000 Subject: [PATCH] Country conversion to ISO code in TomTom bulk geocoding --- .../cartodb_services/cartodb_services/tomtom/bulk_geocoder.py | 4 ++++ server/lib/python/cartodb_services/setup.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py b/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py index 8995200..a92da4c 100644 --- a/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py @@ -5,6 +5,7 @@ from cartodb_services.geocoder import geocoder_error_response from cartodb_services.tomtom import TomTomGeocoder from cartodb_services.tools.qps import qps_retry from cartodb_services.tools.exceptions import ServiceException +from cartodb_services.tools.country import country_to_iso3 class TomTomBulkGeocoder(TomTomGeocoder, StreetPointBulkGeocoder): @@ -35,6 +36,9 @@ class TomTomBulkGeocoder(TomTomGeocoder, StreetPointBulkGeocoder): results = [] for search in searches: (search_id, address, city, state, country) = search + + country = country_to_iso3(country) or country + address = address.encode('utf-8') if address else None city = city.encode('utf-8') if city else None state = state.encode('utf-8') if state else None diff --git a/server/lib/python/cartodb_services/setup.py b/server/lib/python/cartodb_services/setup.py index 0c78707..b056f2d 100644 --- a/server/lib/python/cartodb_services/setup.py +++ b/server/lib/python/cartodb_services/setup.py @@ -10,7 +10,7 @@ from setuptools import setup, find_packages setup( name='cartodb_services', - version='0.23.4', + version='0.23.4-cgonzalez-dev', description='CartoDB Services API Python Library',