File size: 379 Bytes
6d24925
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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)}