Added error handling for geocoder HTTP error

This commit is contained in:
Dmitriy Shishkov 2023-10-29 15:34:42 +03:00
parent 68b92b8bd2
commit 367abfc325
Signed by: dm1sh
GPG Key ID: 027994B0AA357688

View File

@ -45,7 +45,10 @@ async def async_fetch_building_id(
async with session.get(
"https://geocode.gate.petersburg.ru/parse/eas", params={"street": street}
) as r:
try:
res = await r.json()
except aiohttp.client_exceptions.ContentTypeError:
res = "error"
if "error" in res:
return None, None, None