This commit is contained in:
mm 2023-05-05 05:45:01 +00:00
parent 4e2e160072
commit 4c36e07085

View File

@ -57,11 +57,9 @@ def get_coordinates(city_name, country_code="US"):
or None if the city is not found. or None if the city is not found.
""" """
search_results = gc.search_cities(city_name, case_sensitive=True) search_results = gc.search_cities(city_name, case_sensitive=True)
search_results = { search_results = [
k: c d for d in search_results if (d.get("countrycode") == country_code)
for k, c in search_results.items() ]
if (c.get("countrycode") == country_code)
}
if not search_results: if not search_results:
return None return None