File size: 339 Bytes
6c14146
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from fastapi import FastAPI
from utils import scrape_news, analyze_sentiment

app = FastAPI()

@app.get("/analyze/{company_name}")
def analyze_company(company_name: str):
    articles = scrape_news(company_name)
    for article in articles:
        article["sentiment"] = analyze_sentiment(article["summary"])
    return articles