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

13
neuroapi/user.py Normal file
View File

@@ -0,0 +1,13 @@
from aiohttp import ClientSession
from .api_method import ApiMethod
class User(ApiMethod):
async def get(self, id: str, username: str):
payload = {'id': id, 'username': username}
async with ClientSession() as session:
response = await session.post(
self.api_url+'/user/get', data=payload)
data = await response.json()
if 'statusCode' in data:
raise Exception(data['message'])