Код: Выделить всё
class ConnectionCheckEngine():
def __init__(self):
self.data = list()
def run(self):
while True:
self.data.append(self.get_connection_info())
time.sleep(30)
Код: Выделить всё
cce = ConnectionCheckEngine()
if __name__ == '__main__':
cce.run()
Код: Выделить всё
app = FastAPI()
cce = ConnectionCheckEngine()
@app.get("/")
async def root():
return {'data': cce.data}
if __name__ == '__main__':
cce.run()
Подробнее здесь: https://stackoverflow.com/questions/792 ... ogram-loop
Мобильная версия