diff --git a/cartoframes/data/services/geocoding.py b/cartoframes/data/services/geocoding.py index 83cec726e..68bc301a7 100644 --- a/cartoframes/data/services/geocoding.py +++ b/cartoframes/data/services/geocoding.py @@ -324,12 +324,15 @@ def _geocode(self, table_name, street, city=None, state=None, country=None, stat aborted = False if not dry_run: - available_quota = self.available_quota() - if output['required_quota'] > available_quota: - raise Exception('Your CARTO account does not have enough Geocoding quota: {}/{}'.format( - output['required_quota'], - available_quota - )) + provider = self.provider() + + if provider not in ['google']: # Geocoder providers without server quota (use the client API key) + available_quota = self.available_quota() + if output['required_quota'] > available_quota: + raise Exception('Your CARTO account does not have enough Geocoding quota: {}/{}'.format( + output['required_quota'], + available_quota + )) if output['required_quota'] > 0: with TableGeocodingLock(self._execute_query, table_name) as locked: diff --git a/cartoframes/data/services/service.py b/cartoframes/data/services/service.py index db56372cd..6ea83ede7 100644 --- a/cartoframes/data/services/service.py +++ b/cartoframes/data/services/service.py @@ -29,6 +29,10 @@ def _quota_info(self, service): return {k: row.get(k) for k in QUOTA_INFO_KEYS} return None + def provider(self): + info = self._quota_info(self._quota_service) + return info and info.get('provider') + def used_quota(self): info = self._quota_info(self._quota_service) return info and info.get('used_quota')