Skip to content

Commit 6379e35

Browse files
committed
fix: Use correct path, handle datetimes correctly
1 parent 164993b commit 6379e35

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

asknews_sdk/api/news.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,15 @@ def get_index_counts(
280280
http_headers: Optional[Dict] = None,
281281
) -> SearchResponse:
282282
""" """
283+
print(f" Datetimes {start_datetime.isoformat()}, {end_datetime.isoformat()}")
283284
response = self.client.request(
284285
method="GET",
285-
endpoint="/v1/news/index_counts",
286+
endpoint="/v1/index_counts",
286287
query={
287-
"start_datetime": start_datetime,
288-
"end_datetime": end_datetime,
288+
"start_datetime": start_datetime.strftime("%Y-%m-%dT%H:%M:%S"),
289+
"end_datetime": end_datetime.strftime("%Y-%m-%dT%H:%M:%S"),
289290
"time_filter": time_filter,
290-
"categories": categories if categories is not None else ["All"],
291+
"categories": categories,
291292
"provocative": provocative,
292293
"reporting_voice": reporting_voice,
293294
"sampling": sampling,
@@ -691,13 +692,13 @@ async def get_index_counts(
691692
""" """
692693
response = await self.client.request(
693694
method="GET",
694-
endpoint="/v1/news/index_counts",
695+
endpoint="/v1/index_counts",
695696
query={
697+
"start_datetime": start_datetime.strftime("%Y-%m-%dT%H:%M:%S"),
698+
"end_datetime": end_datetime.strftime("%Y-%m-%dT%H:%M:%S"),
696699
"sampling": sampling,
697-
"start_datetime": start_datetime,
698-
"end_datetime": end_datetime,
699700
"time_filter": time_filter,
700-
"categories": categories if categories is not None else ["All"],
701+
"categories": categories,
701702
"provocative": provocative,
702703
"reporting_voice": reporting_voice,
703704
"domains": domains,

0 commit comments

Comments
 (0)