changes
This commit is contained in:
13
httpserver.py
Normal file
13
httpserver.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter
|
||||
from fastapi.responses import FileResponse
|
||||
from consts import FILE_RESULT
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/result.json")
|
||||
async def get_result():
|
||||
if os.path.exists(FILE_RESULT):
|
||||
return FileResponse(FILE_RESULT, media_type="application/json")
|
||||
return {"error": "Файл еще не сгенерирован. Попробуйте позже."}, 404
|
||||
Reference in New Issue
Block a user