mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
18 lines
544 B
Python
18 lines
544 B
Python
from nonebot.log import logger
|
|
|
|
from typing import Any
|
|
|
|
import aiohttp
|
|
|
|
|
|
async def request(Url: str) -> tuple[bool, bool, dict[str, Any]]:
|
|
# 封装请求函数
|
|
try:
|
|
async with aiohttp.ClientSession() as session:
|
|
async with session.get(Url) as resp:
|
|
data = await resp.json()
|
|
return (True, data['success'], data)
|
|
except aiohttp.client_exceptions.ClientConnectorError as e:
|
|
logger.error(f'[TETRIS STATS] request.request: 请求错误\n{e}')
|
|
return (False, False, {})
|