fix(commands:iplocalise|Network): close TUXBOT-BOT-4N

This commit is contained in:
Romain J 2021-05-16 17:28:49 +02:00
parent 09e69166ad
commit fd0600b75d
4 changed files with 12 additions and 5 deletions

View file

@ -12,6 +12,7 @@ disable=
C0114, # missing-module-docstring
C0115, # missing-class-docstring
C0116, # missing-function-docstring
C0415, # import-outside-toplevel
W0703, # broad-except
W0707, # raise-missing-from
R0801, # duplicate-code

View file

@ -229,12 +229,17 @@ async def get_map_bytes(apikey: str, latlon: str) -> Optional[io.BytesIO]:
url = url.format(lonlat=lonlat, apikey=apikey)
async with aiohttp.ClientSession() as cs:
async with cs.get(url) as s:
if s.status != 200:
return None
try:
async with aiohttp.ClientSession() as cs:
async with cs.get(url) as s:
if s.status != 200:
return None
return io.BytesIO(await s.read())
return io.BytesIO(await s.read())
except asyncio.exceptions.TimeoutError:
from ..images.load_fail import value
return io.BytesIO(value)
@cached(

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because one or more lines are too long