fastAPIv2 / routes /api /ingest.py
ragV98's picture
new space launch
6d24925
raw
history blame contribute delete
379 Bytes
from fastapi import APIRouter
import subprocess
router = APIRouter()
@router.get("/ingest-news")
def ingest_news():
try:
subprocess.run(["python", "pipeline/news_ingest.py"], check=True)
return {"status": "success", "message": "News fetched and indexed."}
except subprocess.CalledProcessError as e:
return {"status": "error", "message": str(e)}