25 lines
704 B
Python
25 lines
704 B
Python
|
import aiohttp
|
||
|
|
||
|
from config import Config
|
||
|
|
||
|
class ItSyndikatApi:
|
||
|
base_url: str
|
||
|
config: Config
|
||
|
|
||
|
def __init__(self, config: Config):
|
||
|
self.base_url = "https://it-syndikat.org/api/"
|
||
|
self.config = config
|
||
|
|
||
|
async def status(self):
|
||
|
async with aiohttp.ClientSession() as session:
|
||
|
async with session.get(self.base_url + "status.php") as response:
|
||
|
return await response.json()
|
||
|
|
||
|
|
||
|
async def ping(self):
|
||
|
params = {"apikey": self.config.spaceping_token}
|
||
|
|
||
|
async with aiohttp.ClientSession() as session:
|
||
|
async with session.post(self.base_url + "ping.php", params=params) as response:
|
||
|
await response.text()
|