SeaCogs/pterodactyl/mcsrvstatus.py
SeaswimmerTheFsh 1a23a2778a
All checks were successful
Actions / Build Documentation (MkDocs) (push) Successful in 39s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 54s
misc(pterodactyl): added a missing typehint
2024-05-03 19:42:32 -04:00

10 lines
387 B
Python

import aiohttp
async def get_status(host: str, port: int = 25565) -> tuple[bool, dict]:
async with aiohttp.ClientSession() as session:
async with session.get(f'https://api.mcsrvstat.us/2/{host}:{port}') as response:
response = await response.json()
if response['online']:
return (True, response)
return (False, response)