From 0bdda996efd3d82b98744349596d813deb21d24d Mon Sep 17 00:00:00 2001 From: Adrian Maraj Date: Tue, 23 Jul 2024 14:10:55 +0200 Subject: [PATCH] new: get uuids by category via API --- pylookyloo/api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pylookyloo/api.py b/pylookyloo/api.py index 4e2427f..49a5378 100644 --- a/pylookyloo/api.py +++ b/pylookyloo/api.py @@ -509,6 +509,18 @@ def get_recent_captures(self, timestamp: str | datetime | float | None=None) -> r = self.session.get(url) return r.json() + def get_categories_captures(self, category: str | None=None) -> list[str] | dict[str, list[str]] | None: + '''Get uuids for a specific category or all categorized uuids if category is None + + :param category: The category according to which the uuids are to be returned + ''' + if not category: + url = urljoin(self.root_url, str(PurePosixPath('json', 'categories'))) + else: + url = urljoin(self.root_url, str(PurePosixPath('json', 'categories', category))) + r = self.session.get(url) + return r.json() + @overload def upload_capture(self, *, quiet: Literal[True], listing: bool = False,