"""Содержит всю логику работы с ботами""" from typing import Any import requests import json class Logic(): def __init__(self, app:Any)->None: self.app=app self.port="18061"# Для прода -- 18060 if app.isProd: self.port="18060" def add_new_bot(self, login:str, _pass:str)->None: """Добавляет нового бота на бото ферму""" data:dict[str,str]={ "login":login, "pass":_pass, "is_auto":"true", } res=requests.post("http://localhost:"+self.port+"/list_bot/add", data=data) print(f"Logic.add_new_bot(): result={res}") self.app.gui.winMain.update_list_bot() def get_list_bot(self): """Возвращает список ботов""" res=requests.get("http://localhost:"+self.port+"/list_bot/get") print(f"Logic.add_new_bot(): result={res.text}") content=json.loads(res.content) return content def get_stat_bot(self, name:str): """Возвращает статистику бота""" data={ "name":name, } res=requests.post("http://localhost:"+self.port+"/bot/stat", data=data) print(f"Logic.get_stat_bot(): result={res.text}") content=json.loads(res.content) return content