threaded
This commit is contained in:
parent
abc74fb307
commit
4640a5b57c
@ -99,7 +99,7 @@ class dropout():
|
|||||||
sorted_json_data = sorted(json_data, key=lambda x: x['SHOW'])
|
sorted_json_data = sorted(json_data, key=lambda x: x['SHOW'])
|
||||||
with open('/data/dropout.json', 'w') as json_file:
|
with open('/data/dropout.json', 'w') as json_file:
|
||||||
json.dump(sorted_json_data, json_file, indent=4)
|
json.dump(sorted_json_data, json_file, indent=4)
|
||||||
return JSONResponse(status_code=200, content={"status": "success", "message": "Series information gather successfully."})
|
return JSONResponse(status_code=200, content={"status": "success", "message": "Series information gather successfully."})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return JSONResponse(status_code=500, content={"status": "error", "message": str(e)})
|
return JSONResponse(status_code=500, content={"status": "error", "message": str(e)})
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ from fastapi import FastAPI, Request
|
|||||||
from fastapi.responses import HTMLResponse, JSONResponse
|
from fastapi.responses import HTMLResponse, JSONResponse
|
||||||
from fastapi.templating import Jinja2Templates
|
from fastapi.templating import Jinja2Templates
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
from fastapi.concurrency import run_in_threadpool
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import app.download as download
|
import app.download as download
|
||||||
import json
|
import json
|
||||||
@ -18,7 +19,7 @@ templates = Jinja2Templates(directory="/app/templates")
|
|||||||
# api
|
# api
|
||||||
@app.get("/dropoutUpdate")
|
@app.get("/dropoutUpdate")
|
||||||
async def dropoutUpdate():
|
async def dropoutUpdate():
|
||||||
download.dropout.series()
|
return await run_in_threadpool(download.dropout.series())
|
||||||
|
|
||||||
@app.get("/dropoutSeries", response_class=JSONResponse)
|
@app.get("/dropoutSeries", response_class=JSONResponse)
|
||||||
async def dropoutSeries():
|
async def dropoutSeries():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user