diff --git a/NEWS.md b/NEWS.md index 250eaeb..036318d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,15 @@ +February 27th, 2018 +================== +* Version `0.17.1` of the python library + * Fix bug when the mapzen credentials are not in the db config and we keep getting them + +February 22th, 2018 +================== +* Version `0.17.0` of the python library + * Change default provider to Mapbox + * Remove the obligatory nature of the Mapzen configuration due to its deprecation as provider + February 13th, 2018 ================== * Version `0.16.7` of the python library diff --git a/client/test/expected/00_installation_test.out b/client/test/expected/00_installation_test.out index fe179b7..650b141 100644 --- a/client/test/expected/00_installation_test.out +++ b/client/test/expected/00_installation_test.out @@ -1,3 +1,5 @@ +-- Only show warning or error messages in the tests output +SET client_min_messages TO WARNING; -- Install dependencies CREATE EXTENSION postgis; CREATE EXTENSION plpythonu; diff --git a/client/test/sql/00_installation_test.sql b/client/test/sql/00_installation_test.sql index f091cd4..49eab80 100644 --- a/client/test/sql/00_installation_test.sql +++ b/client/test/sql/00_installation_test.sql @@ -1,3 +1,5 @@ +-- Only show warning or error messages in the tests output +SET client_min_messages TO WARNING; -- Install dependencies CREATE EXTENSION postgis; CREATE EXTENSION plpythonu; diff --git a/server/extension/test/expected/00_install_test.out b/server/extension/test/expected/00_install_test.out index c8204d6..afe969f 100644 --- a/server/extension/test/expected/00_install_test.out +++ b/server/extension/test/expected/00_install_test.out @@ -1,3 +1,5 @@ +-- Only show warning or error messages in the tests output +SET client_min_messages TO WARNING; -- Install dependencies CREATE EXTENSION postgis; CREATE EXTENSION plpythonu; diff --git a/server/extension/test/sql/00_install_test.sql b/server/extension/test/sql/00_install_test.sql index 4ce2667..dde14a0 100644 --- a/server/extension/test/sql/00_install_test.sql +++ b/server/extension/test/sql/00_install_test.sql @@ -1,3 +1,5 @@ +-- Only show warning or error messages in the tests output +SET client_min_messages TO WARNING; -- Install dependencies CREATE EXTENSION postgis; CREATE EXTENSION plpythonu; diff --git a/server/lib/python/cartodb_services/cartodb_services/metrics/config.py b/server/lib/python/cartodb_services/cartodb_services/metrics/config.py index cf4ac96..2d65b9d 100644 --- a/server/lib/python/cartodb_services/cartodb_services/metrics/config.py +++ b/server/lib/python/cartodb_services/cartodb_services/metrics/config.py @@ -137,7 +137,7 @@ class RoutingConfig(ServiceConfig): MAPZEN_PROVIDER = 'mapzen' MAPBOX_PROVIDER = 'mapbox' TOMTOM_PROVIDER = 'tomtom' - DEFAULT_PROVIDER = MAPZEN_PROVIDER + DEFAULT_PROVIDER = MAPBOX_PROVIDER QUOTA_KEY = 'mapzen_routing_quota' SOFT_LIMIT_KEY = 'soft_mapzen_routing_limit' METRICS_LOG_KEY = 'routing_log_path' @@ -148,12 +148,15 @@ class RoutingConfig(ServiceConfig): self._routing_provider = self._redis_config[self.ROUTING_PROVIDER_KEY] if not self._routing_provider: self._routing_provider = self.DEFAULT_PROVIDER - self._mapzen_api_key = self._db_config.mapzen_routing_api_key - self._mapzen_service_params = self._db_config.mapzen_routing_service_params - self._mapbox_api_keys = self._db_config.mapbox_routing_api_keys - self._mapbox_service_params = self._db_config.mapbox_routing_service_params - self._tomtom_api_keys = self._db_config.tomtom_routing_api_keys - self._tomtom_service_params = self._db_config.tomtom_routing_service_params + if self._routing_provider == self.MAPZEN_PROVIDER: + self._mapzen_api_key = self._db_config.mapzen_routing_api_key + self._mapzen_service_params = self._db_config.mapzen_routing_service_params + elif self._routing_provider == self.MAPBOX_PROVIDER: + self._mapbox_api_keys = self._db_config.mapbox_routing_api_keys + self._mapbox_service_params = self._db_config.mapbox_routing_service_params + elif self._routing_provider == self.TOMTOM_PROVIDER: + self._tomtom_api_keys = self._db_config.tomtom_routing_api_keys + self._tomtom_service_params = self._db_config.tomtom_routing_service_params self._set_monthly_quota() self._set_soft_limit() self._period_end_date = date_parse(self._redis_config[self.PERIOD_END_DATE]) @@ -244,7 +247,7 @@ class IsolinesRoutingConfig(ServiceConfig): MAPBOX_PROVIDER = 'mapbox' TOMTOM_PROVIDER = 'tomtom' HEREMAPS_PROVIDER = 'heremaps' - DEFAULT_PROVIDER = MAPZEN_PROVIDER + DEFAULT_PROVIDER = MAPBOX_PROVIDER METRICS_LOG_KEY = 'isolines_log_path' def __init__(self, redis_connection, db_conn, username, orgname=None): @@ -428,7 +431,7 @@ class GeocoderConfig(ServiceConfig): USERNAME_KEY = 'username' ORGNAME_KEY = 'orgname' PERIOD_END_DATE = 'period_end_date' - DEFAULT_PROVIDER = MAPZEN_GEOCODER + DEFAULT_PROVIDER = MAPBOX_GEOCODER METRICS_LOG_KEY = 'geocoder_log_path' def __init__(self, redis_connection, db_conn, username, orgname=None, forced_provider=None): @@ -635,50 +638,51 @@ class ServicesDBConfig: heremaps_conf_json = self._get_conf('heremaps_conf') if not heremaps_conf_json: raise ConfigException('Here maps configuration missing') - else: - heremaps_conf = json.loads(heremaps_conf_json) - self._heremaps_geocoder_app_id = heremaps_conf['geocoder']['app_id'] - self._heremaps_geocoder_app_code = heremaps_conf['geocoder']['app_code'] - self._heremaps_geocoder_cost_per_hit = heremaps_conf['geocoder'][ - 'geocoder_cost_per_hit'] - self._heremaps_geocoder_service_params = heremaps_conf['geocoder'].get('service', {}) - self._heremaps_isolines_app_id = heremaps_conf['isolines']['app_id'] - self._heremaps_isolines_app_code = heremaps_conf['isolines']['app_code'] - self._heremaps_isolines_service_params = heremaps_conf['isolines'].get('service', {}) + + heremaps_conf = json.loads(heremaps_conf_json) + self._heremaps_geocoder_app_id = heremaps_conf['geocoder']['app_id'] + self._heremaps_geocoder_app_code = heremaps_conf['geocoder']['app_code'] + self._heremaps_geocoder_cost_per_hit = heremaps_conf['geocoder'][ + 'geocoder_cost_per_hit'] + self._heremaps_geocoder_service_params = heremaps_conf['geocoder'].get('service', {}) + self._heremaps_isolines_app_id = heremaps_conf['isolines']['app_id'] + self._heremaps_isolines_app_code = heremaps_conf['isolines']['app_code'] + self._heremaps_isolines_service_params = heremaps_conf['isolines'].get('service', {}) def _get_mapzen_config(self): mapzen_conf_json = self._get_conf('mapzen_conf') + # We dont use mapzen anymore so we don't need to check for its configuration if not mapzen_conf_json: - raise ConfigException('Mapzen configuration missing') - else: - mapzen_conf = json.loads(mapzen_conf_json) - self._mapzen_matrix_api_key = mapzen_conf['matrix']['api_key'] - self._mapzen_matrix_quota = mapzen_conf['matrix']['monthly_quota'] - self._mapzen_matrix_service_params = mapzen_conf['matrix'].get('service', {}) - self._mapzen_isochrones_service_params = mapzen_conf.get('isochrones', {}).get('service', {}) - self._mapzen_routing_api_key = mapzen_conf['routing']['api_key'] - self._mapzen_routing_quota = mapzen_conf['routing']['monthly_quota'] - self._mapzen_routing_service_params = mapzen_conf['routing'].get('service', {}) - self._mapzen_geocoder_api_key = mapzen_conf['geocoder']['api_key'] - self._mapzen_geocoder_quota = mapzen_conf['geocoder']['monthly_quota'] - self._mapzen_geocoder_service_params = mapzen_conf['geocoder'].get('service', {}) + return + + mapzen_conf = json.loads(mapzen_conf_json) + self._mapzen_matrix_api_key = mapzen_conf['matrix']['api_key'] + self._mapzen_matrix_quota = mapzen_conf['matrix']['monthly_quota'] + self._mapzen_matrix_service_params = mapzen_conf['matrix'].get('service', {}) + self._mapzen_isochrones_service_params = mapzen_conf.get('isochrones', {}).get('service', {}) + self._mapzen_routing_api_key = mapzen_conf['routing']['api_key'] + self._mapzen_routing_quota = mapzen_conf['routing']['monthly_quota'] + self._mapzen_routing_service_params = mapzen_conf['routing'].get('service', {}) + self._mapzen_geocoder_api_key = mapzen_conf['geocoder']['api_key'] + self._mapzen_geocoder_quota = mapzen_conf['geocoder']['monthly_quota'] + self._mapzen_geocoder_service_params = mapzen_conf['geocoder'].get('service', {}) def _get_mapbox_config(self): mapbox_conf_json = self._get_conf('mapbox_conf') if not mapbox_conf_json: raise ConfigException('Mapbox configuration missing') - else: - mapbox_conf = json.loads(mapbox_conf_json) - self._mapbox_matrix_api_keys = mapbox_conf['matrix']['api_keys'] - self._mapbox_matrix_quota = mapbox_conf['matrix']['monthly_quota'] - self._mapbox_matrix_service_params = mapbox_conf['matrix'].get('service', {}) - self._mapbox_isochrones_service_params = mapbox_conf.get('isochrones', {}).get('service', {}) - self._mapbox_routing_api_keys = mapbox_conf['routing']['api_keys'] - self._mapbox_routing_quota = mapbox_conf['routing']['monthly_quota'] - self._mapbox_routing_service_params = mapbox_conf['routing'].get('service', {}) - self._mapbox_geocoder_api_keys = mapbox_conf['geocoder']['api_keys'] - self._mapbox_geocoder_quota = mapbox_conf['geocoder']['monthly_quota'] - self._mapbox_geocoder_service_params = mapbox_conf['geocoder'].get('service', {}) + + mapbox_conf = json.loads(mapbox_conf_json) + self._mapbox_matrix_api_keys = mapbox_conf['matrix']['api_keys'] + self._mapbox_matrix_quota = mapbox_conf['matrix']['monthly_quota'] + self._mapbox_matrix_service_params = mapbox_conf['matrix'].get('service', {}) + self._mapbox_isochrones_service_params = mapbox_conf.get('isochrones', {}).get('service', {}) + self._mapbox_routing_api_keys = mapbox_conf['routing']['api_keys'] + self._mapbox_routing_quota = mapbox_conf['routing']['monthly_quota'] + self._mapbox_routing_service_params = mapbox_conf['routing'].get('service', {}) + self._mapbox_geocoder_api_keys = mapbox_conf['geocoder']['api_keys'] + self._mapbox_geocoder_quota = mapbox_conf['geocoder']['monthly_quota'] + self._mapbox_geocoder_service_params = mapbox_conf['geocoder'].get('service', {}) def _get_tomtom_config(self): tomtom_conf_json = self._get_conf('tomtom_conf')