fix(commands:iplocalise|Network): close TUXBOT-BOT-4N
This commit is contained in:
parent
09e69166ad
commit
fd0600b75d
4 changed files with 12 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -229,12 +229,17 @@ async def get_map_bytes(apikey: str, latlon: str) -> Optional[io.BytesIO]:
|
|||
|
||||
url = url.format(lonlat=lonlat, apikey=apikey)
|
||||
|
||||
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())
|
||||
except asyncio.exceptions.TimeoutError:
|
||||
from ..images.load_fail import value
|
||||
|
||||
return io.BytesIO(value)
|
||||
|
||||
|
||||
@cached(
|
||||
|
|
BIN
tuxbot/cogs/Network/images/load_fail.png
Normal file
BIN
tuxbot/cogs/Network/images/load_fail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
1
tuxbot/cogs/Network/images/load_fail.py
Normal file
1
tuxbot/cogs/Network/images/load_fail.py
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue