From ea2da15f2b04e3b4febf2230d4fbb0e2d6147dfc Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Sun, 25 Aug 2024 14:13:21 +0200 Subject: fastapi testing --- __main__.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to '__main__.py') diff --git a/__main__.py b/__main__.py index 46d2815..16b0f63 100644 --- a/__main__.py +++ b/__main__.py @@ -1,10 +1,19 @@ import os.path +from fastapi import FastAPI +from .datatemplates.agent_id import AgentId from .modules import daemon from .config import Config -if __name__ == "__main__": - with open(os.path.join(os.path.dirname(__file__), Config.TOKEN_FILE_NAME)) as f: - token = f.read().strip() +app = FastAPI() - d = daemon.Daemon(Config.AGENT_SYMBOL, token) - d.run() + +@app.post("/tasks") +async def get_tasks(agent_id: AgentId): + return "foo" + +# if __name__ == "__main__": +# with open(os.path.join(os.path.dirname(__file__), Config.TOKEN_FILE_NAME)) as f: +# token = f.read().strip() +# +# d = daemon.Daemon(Config.AGENT_SYMBOL, token) +# d.run() -- cgit v1.2.3-70-g09d2