Only take the first component of formatted_address

This commit is contained in:
Fabio Manganiello 2018-05-23 08:06:52 +00:00
parent 3ce6cf8b41
commit a8015addbf

View file

@ -33,7 +33,7 @@ class GoogleMapsPlugin(GooglePlugin):
logging.info('Google Maps geocode response for latlng ({},{}): {}'. logging.info('Google Maps geocode response for latlng ({},{}): {}'.
format(latitude, longitude, result)) format(latitude, longitude, result))
address['address'] = result['formatted_address'] address['address'] = result['formatted_address'].split(',')[0]
for addr_component in result['address_components']: for addr_component in result['address_components']:
for component_type in addr_component['types']: for component_type in addr_component['types']:
if component_type == 'locality': if component_type == 'locality':