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 ec3949f..8036667 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 @@ -106,7 +106,7 @@ class TomTomBulkGeocoder(TomTomGeocoder, StreetPointBulkGeocoder): def _query(self, search): (search_id, address, city, state, country) = search searchtext = ', '.join(filter(None, [address, city, state])) - return self._request_uri(searchtext=searchtext, countries=country) + return self._request_uri(searchtext=searchtext, country=country) def _parse_results(self, json_body): return [self._parse_response(item['statusCode'], item['response']) diff --git a/server/lib/python/cartodb_services/cartodb_services/tomtom/geocoder.py b/server/lib/python/cartodb_services/cartodb_services/tomtom/geocoder.py index 1f63f58..b4e82cb 100644 --- a/server/lib/python/cartodb_services/cartodb_services/tomtom/geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/tomtom/geocoder.py @@ -30,13 +30,14 @@ class TomTomGeocoder(Traceable): self._apikey = apikey self._logger = logger - def _uri(self, searchtext, countries=None): - return API_BASEURI + self._request_uri(searchtext, countries, self._apikey) + def _uri(self, searchtext, country=None): + return HOST + API_BASEURI + \ + self._request_uri(searchtext, country, self._apikey) - def _request_uri(self, searchtext, countries=None, apiKey=None): + def _request_uri(self, searchtext, country=None, apiKey=None): baseuri = REQUEST_BASEURI - if countries: - baseuri += '&countrySet={}'.format(countries) + if country: + baseuri += '&countrySet={}'.format(country) baseuri = baseuri + '&key={apiKey}' if apiKey else baseuri return URITemplate(baseuri).expand(apiKey=apiKey, searchtext=searchtext.encode('utf-8')) @@ -81,7 +82,7 @@ class TomTomGeocoder(Traceable): if state_province: address.append(normalize(state_province)) - uri = HOST + self._uri(searchtext=', '.join(address), countries=country) + uri = self._uri(searchtext=', '.join(address), country=country) try: response = requests.get(uri)