diff --git a/pylookyloo/api.py b/pylookyloo/api.py index 4e2427f..4a62fe8 100644 --- a/pylookyloo/api.py +++ b/pylookyloo/api.py @@ -498,14 +498,26 @@ def send_mail(self, tree_uuid: str, email: str = '', comment: str | None = None) def get_recent_captures(self, timestamp: str | datetime | float | None=None) -> list[str]: '''Gets the uuids of the most recent captures - :param timestamp: Timestamp of the capture + :param timestamp: Oldest timestamp to consider ''' - if not timestamp: - url = urljoin(self.root_url, str(PurePosixPath('json', 'recent_captures'))) - else: + if timestamp: if isinstance(timestamp, datetime): timestamp = timestamp.timestamp() url = urljoin(self.root_url, str(PurePosixPath('json', 'recent_captures', str(timestamp)))) + else: + url = urljoin(self.root_url, str(PurePosixPath('json', 'recent_captures'))) + 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 category: + url = urljoin(self.root_url, str(PurePosixPath('json', 'categories', category))) + else: + url = urljoin(self.root_url, str(PurePosixPath('json', 'categories'))) r = self.session.get(url) return r.json()