Initial commit from Martins Github
This commit is contained in:
20
app/routers/emulated_session.py
Normal file
20
app/routers/emulated_session.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import asyncio
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from app.services import ueransim
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post("/emulated-session/start")
|
||||
async def start_emulated_session():
|
||||
task_id = ueransim.create_task()
|
||||
asyncio.create_task(ueransim.run_test(task_id))
|
||||
return {"task_id": task_id}
|
||||
|
||||
|
||||
@router.get("/emulated-session/status/{task_id}")
|
||||
async def get_emulated_session_status(task_id: str):
|
||||
task = ueransim.get_task(task_id)
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail="Task not found")
|
||||
return task
|
||||
Reference in New Issue
Block a user