Set geoloc_city one level up so it's always set
This commit is contained in:
parent
0100603aa2
commit
d6de76377f
1 changed files with 6 additions and 8 deletions
14
scl.py
14
scl.py
|
@ -182,15 +182,15 @@ def do_initial_post(
|
||||||
print("JSON could not be loaded from nominatim API")
|
print("JSON could not be loaded from nominatim API")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
if geocode["features"][0]["properties"]["geocoding"]["city"] != "Seattle":
|
city = geocode["features"][0]["properties"]["geocoding"]["city"]
|
||||||
city_not_seattle_text = " of {}".format(
|
street = geocode["features"][0]["properties"]["geocoding"]["name"]
|
||||||
geocode["features"][0]["properties"]["geocoding"]["city"]
|
event["geoloc_city"] = city
|
||||||
)
|
|
||||||
|
if city != "Seattle":
|
||||||
|
city_not_seattle_text = " of {}".format(city)
|
||||||
else:
|
else:
|
||||||
city_not_seattle_text = ""
|
city_not_seattle_text = ""
|
||||||
|
|
||||||
street = geocode["features"][0]["properties"]["geocoding"]["name"]
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
"locality" in geocode["features"][0]["properties"]["geocoding"]
|
"locality" in geocode["features"][0]["properties"]["geocoding"]
|
||||||
and event_class["size"] != "Large"
|
and event_class["size"] != "Large"
|
||||||
|
@ -219,13 +219,11 @@ def do_initial_post(
|
||||||
)
|
)
|
||||||
event["neighborhood"] = district
|
event["neighborhood"] = district
|
||||||
else:
|
else:
|
||||||
city = geocode["features"][0]["properties"]["geocoding"]["city"]
|
|
||||||
alt_text = "A map showing the location of the outage, centered around {} in {}.".format(
|
alt_text = "A map showing the location of the outage, centered around {} in {}.".format(
|
||||||
street,
|
street,
|
||||||
city,
|
city,
|
||||||
)
|
)
|
||||||
area_text = city
|
area_text = city
|
||||||
event["geoloc_city"] = city
|
|
||||||
except Exception:
|
except Exception:
|
||||||
alt_text = "A map showing the location of the outage."
|
alt_text = "A map showing the location of the outage."
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue