from typing import Annotated from fastapi import FastAPI, Depends, Request from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm app = FastAPI() oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") @app.post("/token") async def login(form_data: OAuth2PasswordRequestForm = Depends()): user = form_data.username return {"access_token": user, "token_type": "bearer"} @app.get("/{callsign}/tasks") async def get_tasks(callsign: str, token: Annotated[str, Depends(oauth2_scheme)]): return f'{{"callsign": "{callsign}", "token": "{token}"}}' # 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()