aboutsummaryrefslogtreecommitdiff
path: root/fetch-location
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-09-10 19:16:10 +0100
committerdiogo464 <[email protected]>2025-09-10 19:16:10 +0100
commitb2f7cb8ed9f6c0c99f17e35e3a0395cffdd03b0d (patch)
treef7319cb99b746ce5f186991acd47e6197db9cb87 /fetch-location
parent9226f247f2040d82afa77f6b819314c6dc4f0339 (diff)
4 added, 4 updated
Diffstat (limited to 'fetch-location')
-rwxr-xr-xfetch-location9
1 files changed, 7 insertions, 2 deletions
diff --git a/fetch-location b/fetch-location
index 47bd064f0..41f1513d9 100755
--- a/fetch-location
+++ b/fetch-location
@@ -185,11 +185,12 @@ class GoogleGeocodingClient:
185 content = response.content 185 content = response.content
186 # print(f"GEOCODING|Google API content|{location}|{content}") 186 # print(f"GEOCODING|Google API content|{location}|{content}")
187 data = json.loads(content) 187 data = json.loads(content)
188 print(data)
188 result = data["results"][0] 189 result = data["results"][0]
189 # print(f"GEOCODING|Google API result|{location}|{result}") 190 # print(f"GEOCODING|Google API result|{location}|{result}")
190 return self._parse_google_response(location, result) 191 return self._parse_google_response(location, result)
191 except Exception as e: 192 except Exception as e:
192 # print(f"GEOCODING|Error|{location}|{str(e)}") 193 print(f"GEOCODING|Error|{location}|{str(e)}")
193 return None 194 return None
194 195
195 196
@@ -216,7 +217,11 @@ def clean_ics_location(loc: str) -> str:
216 return ", ".join(segments) 217 return ", ".join(segments)
217 218
218 219
219FIXUP_TABLE = {"Alcaria da Serra, Beja": "Alcaria da Serra"} 220FIXUP_TABLE = {
221 "Alcaria da Serra, Beja": "Alcaria da Serra",
222 # this seems to have been a typo in the ICS file so we just fix it here
223 "Cabeço de Vida, Fontreira": "Cabeço de Vide, Fontreira",
224}
220 225
221key = os.environ[ENV_GOOGLE_MAPS_API_KEY] 226key = os.environ[ENV_GOOGLE_MAPS_API_KEY]
222client = GoogleGeocodingClient(key) 227client = GoogleGeocodingClient(key)