Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def geocode_addr(addr, city):
"""
Given a string and a city, determine if the address is in Boston, MA
:param addr: string corresponding to the address
:param city: the city of interest
:return: boolean
"""
m_location = geocode(addr)
for location in m_location:
if location['score'] < 100:
continue
if location['attributes']['MetroArea'] \
and location['attributes']['MetroArea'] != city:
continue
if location['attributes']['City'] \
and location['attributes']['City'] not in NEIGHBORHOODS:
continue
return True
# No address found in the provided city
return False
def geocode_address(m_address):
"""
:param m_address: address of interest in street form
:return: address in coordinate (X and Y) form
"""
m_address = m_address + ", City: Boston, State: MA"
m_location = geocode(address=m_address)[0]
return m_location['location']