diff --git a/geocoder/geocoder.py b/geocoder/geocoder.py index 9156ae2..fb155a2 100644 --- a/geocoder/geocoder.py +++ b/geocoder/geocoder.py @@ -48,7 +48,7 @@ class Geocoder: while not task.is_successfull(): task.geocode() - if task.tries < 3 or task.success_surrender_retry == 'Surrender': + if task.tries > 3 or task.success_surrender_retry == 'Surrender': geo_data = {'latitude': None, 'longitude': None, 'precision': 'SIN RESULTADOS'} @@ -59,18 +59,19 @@ class Geocoder: geo_data['precision']) break - geo_data = task.get_results() + if not (task.tries > 3 or task.success_surrender_retry == 'Surrender'): + geo_data = task.get_results() - self.cache.add_address(address, - geo_data['latitude'], - geo_data['longitude'], - geo_data['precision']) + self.cache.add_address(address, + geo_data['latitude'], + geo_data['longitude'], + geo_data['precision']) - capturas_interface.update_geo_data(ad_data['referencia'], - ad_data['fecha_captura'], - geo_data['latitude'], - geo_data['longitude'], - geo_data['precision']) + capturas_interface.update_geo_data(ad_data['referencia'], + ad_data['fecha_captura'], + geo_data['latitude'], + geo_data['longitude'], + geo_data['precision']) class GeocodingCache: