NLP_genAI_final / agents /datacollector.py
irebmann's picture
Update agents/datacollector.py
354ec89 verified
raw
history blame contribute delete
401 Bytes
import requests
from config import Config
class DataCollectionAgent:
def __init__(self, config):
self.config = config
def collect_news(self, ticker):
url = f"https://finnhub.io/api/v1/company-news?symbol={ticker}&from=2023-01-01&to=2025-12-31&token={self.config.FINNHUB_API_KEY}"
resp = requests.get(url)
return resp.json() if resp.status_code == 200 else []