From 5275befffa9a1ea899be3da5ae07bfef0baecf8b Mon Sep 17 00:00:00 2001 From: Adrian Maraj Date: Wed, 19 Jun 2024 10:47:57 +0200 Subject: [PATCH 1/3] adding get_recent_captures --- pylookyloo/api.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pylookyloo/api.py b/pylookyloo/api.py index f544e8c..6f5d237 100644 --- a/pylookyloo/api.py +++ b/pylookyloo/api.py @@ -494,6 +494,12 @@ def send_mail(self, tree_uuid: str, email: str = '', comment: str | None = None) r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', tree_uuid, 'report'))), json=to_send) return r.json() + def get_recent_captures(self) -> list: + '''Gets the uuids of the most recent captures + ''' + r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json/recent_captures')))) + return r.json() + @overload def upload_capture(self, *, quiet: Literal[True], listing: bool = False, From ab2c84f437fbd401bbdb6ffacefcc3529cb7a5e9 Mon Sep 17 00:00:00 2001 From: Adrian Maraj Date: Wed, 19 Jun 2024 12:00:46 +0200 Subject: [PATCH 2/3] adding timestamp --- pylookyloo/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pylookyloo/api.py b/pylookyloo/api.py index 6f5d237..6372ee1 100644 --- a/pylookyloo/api.py +++ b/pylookyloo/api.py @@ -494,10 +494,12 @@ def send_mail(self, tree_uuid: str, email: str = '', comment: str | None = None) r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', tree_uuid, 'report'))), json=to_send) return r.json() - def get_recent_captures(self) -> list: + def get_recent_captures(self, timestamp:str) -> list: '''Gets the uuids of the most recent captures + + :param timestamp: Timestamp of the capture ''' - r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json/recent_captures')))) + r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json/recent_captures/', timestamp)))) return r.json() @overload From 978e2f563e1cf4fe6ded4f58bab84f5cc0560ef9 Mon Sep 17 00:00:00 2001 From: Adrian Maraj Date: Wed, 19 Jun 2024 12:15:56 +0200 Subject: [PATCH 3/3] adding missing type parameter --- pylookyloo/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylookyloo/api.py b/pylookyloo/api.py index 6372ee1..6ef972a 100644 --- a/pylookyloo/api.py +++ b/pylookyloo/api.py @@ -494,7 +494,7 @@ def send_mail(self, tree_uuid: str, email: str = '', comment: str | None = None) r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', tree_uuid, 'report'))), json=to_send) return r.json() - def get_recent_captures(self, timestamp:str) -> list: + def get_recent_captures(self, timestamp:str) -> list[str]: '''Gets the uuids of the most recent captures :param timestamp: Timestamp of the capture