From: Michael Tremer Date: Wed, 31 Dec 2025 13:22:58 +0000 (+0000) Subject: api: Export the history X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6410235d6410fd419497ce4ee092034d229a8b6;p=dbl.git api: Export the history Signed-off-by: Michael Tremer --- diff --git a/src/dnsbl/api/lists.py b/src/dnsbl/api/lists.py index 069c2ce..b33319f 100644 --- a/src/dnsbl/api/lists.py +++ b/src/dnsbl/api/lists.py @@ -54,6 +54,19 @@ def get_list(list = fastapi.Depends(get_list_from_path)) -> lists.List: return list +@router.get("/{list}/history") +def get_list_history( + list = fastapi.Depends(get_list_from_path), + limit: int = 10, + ): + # Return the history as a dictionary + return { + e.ts : { + "domains_added" : e.domains_added, + "domains_removed" : e.domains_removed, + } for e in list.get_history(limit=limit) + } + @router.get("/{list}/sources") def get_list_sources(list = fastapi.Depends(get_list_from_path)) -> typing.List[sources.Source]: return list.sources