mirror of
https://gitlab.sectorq.eu/jaydee/api_server.git
synced 2026-09-17 02:12:55 +02:00
19 lines
442 B
Python
19 lines
442 B
Python
from fastapi import FastAPI, Depends
|
|
from app.auth import verify_token
|
|
from app.scripts import script1, script2
|
|
|
|
app = FastAPI()
|
|
|
|
@app.get("/")
|
|
def root():
|
|
return {"status": "API running"}
|
|
|
|
@app.post("/script1")
|
|
def run_script1(auth=Depends(verify_token)):
|
|
result = script1.run()
|
|
return {"result": result}
|
|
|
|
@app.post("/script2")
|
|
def run_script2(auth=Depends(verify_token)):
|
|
result = script2.run()
|
|
return {"result": result} |