From ffb9613d352deb7614136ee9ad59f2d2f204d634 Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Wed, 4 Dec 2024 00:47:49 +0100 Subject: [PATCH 1/2] [client] add allow query params for fetch_one --- gazu/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gazu/client.py b/gazu/client.py index d707496..bc029f9 100644 --- a/gazu/client.py +++ b/gazu/client.py @@ -464,7 +464,7 @@ def fetch_first(path, params=None, client=default_client): return None -def fetch_one(model_name, id, client=default_client): +def fetch_one(model_name, id, params=None, client=default_client): """ Function dedicated at targeting routes that returns a single model instance. @@ -476,7 +476,9 @@ def fetch_one(model_name, id, client=default_client): Returns: dict: The model instance matching id and model name. """ - return get(url_path_join("data", model_name, id), client=client) + return get( + url_path_join("data", model_name, id), params=params, client=client + ) def create(model_name, data, client=default_client): From baae872643ad2557dbf134253b41b043ac09ccd2 Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Fri, 6 Dec 2024 15:56:35 +0100 Subject: [PATCH 2/2] [events] parameter has changed for page_size it's limit now --- gazu/sync.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gazu/sync.py b/gazu/sync.py index 225a4ca..9e81be1 100644 --- a/gazu/sync.py +++ b/gazu/sync.py @@ -17,7 +17,7 @@ def get_last_events( - page_size=20000, + limit=20000, project=None, after=None, before=None, @@ -29,7 +29,7 @@ def get_last_events( Get last events that occured on the machine. Args: - page_size (int): Number of events to retrieve. + limit (int): Number of events to retrieve. project (dict/id): Get only events related to this project. after (dict/id): Get only events occuring after given date. before (dict/id): Get only events occuring before given date. @@ -39,7 +39,7 @@ def get_last_events( dict: Last events matching criterions. """ path = "/data/events/last" - params = {"page_size": page_size, "only_files": only_files} + params = {"limit": limit, "only_files": only_files} if project is not None: project = normalize_model_parameter(project) params["project_id"] = project["id"]