Skip to content

Commit ad354b7

Browse files
committed
fix date range
1 parent 019f2dd commit ad354b7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

agents/news_agent/news_agent.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
page_size = 10
2424
page = 1
2525

26-
today = datetime.today()
27-
date_28_days_ago = today - timedelta(days=28)
28-
formatted_date = date_28_days_ago.strftime("%Y-%m-%d")
2926

3027

3128
def fetch_latest_news_gdelt(query: str) -> Optional[str]:
@@ -117,6 +114,10 @@ def fetch_all_articles(query: str, sources: str, domains: str, to: str, language
117114
List of articles' titles and urls.
118115
"""
119116

117+
today = datetime.today()
118+
date_28_days_ago = today - timedelta(days=28)
119+
formatted_date = date_28_days_ago.strftime("%Y-%m-%d")
120+
120121
all_articles = newsapi.get_everything(q=query,
121122
sources=sources,
122123
domains=domains,

0 commit comments

Comments
 (0)