feat: Semaine 8
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user