ragV98 commited on
Commit
714bcf5
·
1 Parent(s): 1d3bc1d
components/gateways/headlines_to_wa.py CHANGED
@@ -2,7 +2,6 @@ import os
2
  import json
3
  import redis
4
  import requests
5
- from fastapi import FastAPI
6
 
7
  # 🌐 Redis config
8
  REDIS_URL = os.environ.get("UPSTASH_REDIS_URL", "redis://localhost:6379")
@@ -13,8 +12,6 @@ WHATSAPP_TO_NUMBER = os.environ.get("WHATSAPP_TO_NUMBER") # e.g., "91xxxxxxxxxx
13
  # Connect to Redis
14
  redis_client = redis.Redis.from_url(REDIS_URL, decode_responses=True)
15
 
16
- app = FastAPI()
17
-
18
  # 🧾 Load and format cache
19
  def fetch_cached_headlines() -> str:
20
  try:
 
2
  import json
3
  import redis
4
  import requests
 
5
 
6
  # 🌐 Redis config
7
  REDIS_URL = os.environ.get("UPSTASH_REDIS_URL", "redis://localhost:6379")
 
12
  # Connect to Redis
13
  redis_client = redis.Redis.from_url(REDIS_URL, decode_responses=True)
14
 
 
 
15
  # 🧾 Load and format cache
16
  def fetch_cached_headlines() -> str:
17
  try:
routes/api/wa_headlines.py CHANGED
@@ -5,8 +5,7 @@ from components.gateways.headlines_to_wa import fetch_cached_headlines, send_to_
5
 
6
  router = APIRouter()
7
 
8
- # 🔌 Endpoint to trigger sending
9
- @app.post("/send-digest")
10
  def send_digest():
11
  message = fetch_cached_headlines()
12
  if not message:
 
5
 
6
  router = APIRouter()
7
 
8
+ @router.get("/wa-headlines")
 
9
  def send_digest():
10
  message = fetch_cached_headlines()
11
  if not message: