24 lines
763 B
Python
24 lines
763 B
Python
from fastapi import FastAPI
|
|
from application.usecases.run_watch_cycle import RunWatchCycleUsecase
|
|
|
|
from adapters.outbound.rss_feed_adapter import RssFeedAdapter
|
|
from adapters.outbound.cli_notifier import CliNotifierAdapter
|
|
from domain.matcher import MatchingService
|
|
|
|
app = FastAPI()
|
|
|
|
rss_adapter = RssFeedAdapter("https://www.lemonde.fr/rss/une.xml")
|
|
notifier = CliNotifierAdapter()
|
|
matcher = MatchingService()
|
|
usecase = RunWatchCycleUsecase(rss_adapter, notifier, matcher)
|
|
|
|
@app.get("/rss/{keyword}")
|
|
def run_watch_by_http(keyword: str):
|
|
result = usecase.execute(keywords=[keyword])
|
|
|
|
return {
|
|
"status": "success",
|
|
"keyword_searched": keyword,
|
|
"articles_processed": result.processed,
|
|
"alerts_sent": result.alerts_sent
|
|
} |