diff --git a/server/lib/python/cartodb_services/cartodb_services/tools/__init__.py b/server/lib/python/cartodb_services/cartodb_services/tools/__init__.py index d8ca7f1..976469a 100644 --- a/server/lib/python/cartodb_services/cartodb_services/tools/__init__.py +++ b/server/lib/python/cartodb_services/cartodb_services/tools/__init__.py @@ -3,5 +3,7 @@ from coordinates import Coordinate from polyline import PolyLine from log import Logger, LoggerConfig from rate_limiter import RateLimiter -from service_manager import ServiceManager, RateLimitExceeded, QuotaExceededException +from service_manager import ServiceManager from legacy_service_manager import LegacyServiceManager +from exceptions import QuotaExceededException, RateLimitExceeded +from country import country_to_iso3 diff --git a/server/lib/python/cartodb_services/cartodb_services/tools/exceptions.py b/server/lib/python/cartodb_services/cartodb_services/tools/exceptions.py index a970679..f34822e 100644 --- a/server/lib/python/cartodb_services/cartodb_services/tools/exceptions.py +++ b/server/lib/python/cartodb_services/cartodb_services/tools/exceptions.py @@ -1,6 +1,5 @@ import json - class TimeoutException(Exception): def __str__(self): return repr('Timeout requesting to server') @@ -29,3 +28,11 @@ class WrongParams(Exception): class MalformedResult(Exception): def __str__(self): return repr('Result structure is malformed') + +class RateLimitExceeded(Exception): + def __str__(self): + return repr('Rate limit exceeded') + +class QuotaExceededException(Exception): + def __str__(self): + return repr('You have reached the limit of your quota') diff --git a/server/lib/python/cartodb_services/cartodb_services/tools/service_manager.py b/server/lib/python/cartodb_services/cartodb_services/tools/service_manager.py index fd0d926..4dd8f9a 100644 --- a/server/lib/python/cartodb_services/cartodb_services/tools/service_manager.py +++ b/server/lib/python/cartodb_services/cartodb_services/tools/service_manager.py @@ -1,20 +1,12 @@ from cartodb_services.metrics import QuotaService -from cartodb_services.tools import Logger -from cartodb_services.tools import RateLimiter +from cartodb_services.tools.log import Logger +from cartodb_services.tools.rate_limiter import RateLimiter +from cartodb_services.tools.exceptions import QuotaExceededException, RateLimitExceeded from cartodb_services.refactor.tools.logger import LoggerConfigBuilder from cartodb_services.refactor.backend.redis_metrics_connection import RedisMetricsConnectionFactory from cartodb_services.config import ServiceConfiguration, RateLimitsConfigBuilder -class RateLimitExceeded(Exception): - def __str__(self): - return repr('Rate limit exceeded') - -class QuotaExceededException(Exception): - def __str__(self): - return repr('You have reached the limit of your quota') - - class ServiceManagerBase: """ A Service manager collects the configuration needed to use a service,