mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-06-24 22:29:56 +02:00
23 lines
602 B
Python
23 lines
602 B
Python
from pathlib import Path
|
|
|
|
from fastapi import APIRouter, Response
|
|
from fastapi.responses import FileResponse, StreamingResponse
|
|
|
|
from ..primitives import Table
|
|
from ..report_chart import plot_security_report
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/failures")
|
|
async def failures_csv():
|
|
if not Path("failures.csv").exists():
|
|
return {"error": "No failures found"}
|
|
return FileResponse("failures.csv")
|
|
|
|
|
|
@router.post("/plot.jpeg", response_class=Response)
|
|
async def get_plot(table: Table):
|
|
buf = plot_security_report(table.table)
|
|
return StreamingResponse(buf, media_type="image/jpeg")
|