from fastapi import APIRouter | |
import subprocess | |
router = APIRouter() | |
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)} | |