diff --git a/python_sdk/infrahub_sdk/client.py b/python_sdk/infrahub_sdk/client.py index 972c0d73e5..c0543b0fc0 100644 --- a/python_sdk/infrahub_sdk/client.py +++ b/python_sdk/infrahub_sdk/client.py @@ -415,14 +415,14 @@ async def get( filters[schema.default_filter] = id else: filters["ids"] = [id] - elif hfid: + if hfid: if isinstance(schema, NodeSchema) and schema.human_friendly_id: filters["hfid"] = hfid else: raise ValueError("Cannot filter by HFID if the node doesn't have an HFID defined") - elif kwargs: - filters = kwargs - else: + if kwargs: + filters.update(kwargs) + if len(filters) == 0: raise ValueError("At least one filter must be provided to get()") results = await self.filters( @@ -1789,14 +1789,14 @@ def get( filters[schema.default_filter] = id else: filters["ids"] = [id] - elif hfid: + if hfid: if isinstance(schema, NodeSchema) and schema.human_friendly_id: filters["hfid"] = hfid else: raise ValueError("Cannot filter by HFID if the node doesn't have an HFID defined") - elif kwargs: - filters = kwargs - else: + if kwargs: + filters.update(kwargs) + if len(filters) == 0: raise ValueError("At least one filter must be provided to get()") results = self.filters(