Added error handling for geocoder HTTP error
This commit is contained in:
parent
68b92b8bd2
commit
367abfc325
@ -45,7 +45,10 @@ async def async_fetch_building_id(
|
|||||||
async with session.get(
|
async with session.get(
|
||||||
"https://geocode.gate.petersburg.ru/parse/eas", params={"street": street}
|
"https://geocode.gate.petersburg.ru/parse/eas", params={"street": street}
|
||||||
) as r:
|
) as r:
|
||||||
res = await r.json()
|
try:
|
||||||
|
res = await r.json()
|
||||||
|
except aiohttp.client_exceptions.ContentTypeError:
|
||||||
|
res = "error"
|
||||||
|
|
||||||
if "error" in res:
|
if "error" in res:
|
||||||
return None, None, None
|
return None, None, None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user