ADDED: module for work with api

This commit is contained in:
2023-11-22 20:48:27 +05:00
parent d286da698e
commit ce940f7646
8 changed files with 124 additions and 0 deletions

17
neuroapi/admin.py Normal file
View File

@@ -0,0 +1,17 @@
from aiohttp import ClientSession
from .api_method import ApiMethod
class Admin(ApiMethod):
async def get(self):
async with ClientSession() as session:
response = await session.get(self.api_url+'/admin/get')
return await response.json()
async def is_admin(self, id: str):
async with ClientSession() as session:
response = await session.get(self.api_url+f'admin/is-admin/{id}')
if await response.text() == 'false':
return False
return True