Apply ServiceManager to Google Geocoder

Note that the Goolge geocoder uses QuotaService to account for used quota,
but it doesn't have a quota limit.
This commit is contained in:
Javier Goizueta
2017-03-15 17:58:14 +01:00
parent 696bdb40b0
commit cebd7d2141
2 changed files with 11 additions and 16 deletions

View File

@@ -1,10 +1,10 @@
from exceptions import RateLimitExceeded
class ServiceManagerBase:
def check(self):
if not self.rate_limiter.check():
def check(self, quota=True, rate=True):
if rate and not self.rate_limiter.check():
raise RateLimitExceeded()
if not self.quota_service.check_user_quota():
if quota and not self.quota_service.check_user_quota():
raise Exception('You have reached the limit of your quota')
@property