Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bfabric/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Minor breaking changes are still possible in `1.X.Y` but we try to announce them

## \[Unreleased\]

### Added

- `Bfabric.read` supports `method` parameter to specify alternative read methods.

## \[1.16.1\] - 2025-12-15

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions bfabric/src/bfabric/bfabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def read(
offset: int = 0,
check: bool = True,
return_id_only: bool = False,
method: str = "read",
) -> ResultContainer:
"""Reads from the specified endpoint matching all specified attributes in `obj`.
By setting `max_results` it is possible to change the number of results that are returned.
Expand All @@ -211,6 +212,7 @@ def read(
is 0 which means no skipping)
:param check: whether to raise an error if the response is not successful
:param return_id_only: whether to return only the ids of the found objects
:param method: alternative SOAP method to use for reading data
:return: List of responses, packaged in the results container
"""
# Get the first page.
Expand All @@ -219,6 +221,7 @@ def read(
endpoint=endpoint,
obj=obj,
auth=self.auth,
method=method,
page=1,
return_id_only=return_id_only,
)
Expand Down Expand Up @@ -248,6 +251,7 @@ def read(
endpoint=endpoint,
obj=obj,
auth=self.auth,
method=method,
page=i_page,
return_id_only=return_id_only,
)
Expand Down
7 changes: 6 additions & 1 deletion bfabric/src/bfabric/engine/engine_suds.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
endpoint: str,
obj: ApiRequestObjectType,
auth: BfabricAuth,
method: str = "read",
page: int = 1,
return_id_only: bool = False,
include_deletable_and_updatable_fields: bool = False,
Expand All @@ -42,6 +43,7 @@
:param obj: a dictionary containing the query, for every field multiple possible values can be provided, the
final query requires the condition for each field to be met
:param auth: the authentication handle of the user performing the request
:param method: alternative SOAP method to use for reading data
:param page: the page number to read
:param return_id_only: whether to return only the ids of the objects
:param include_deletable_and_updatable_fields: whether to include the deletable and updatable fields
Expand All @@ -57,7 +59,10 @@
"idonly": return_id_only,
}
service = self._get_suds_service(endpoint)
response = service.read(full_query)
try:
response = getattr(service, method)(full_query)
except MethodNotFound as e:
raise BfabricRequestError(f"SUDS failed to find method '{method}'") from e
return self._convert_results(response=response, endpoint=endpoint)

def save(
Expand All @@ -77,7 +82,7 @@
query = {"login": auth.login, "password": auth.password.get_secret_value(), endpoint: obj}
service = self._get_suds_service(endpoint)
try:
response = getattr(service, method)(query)

Check warning on line 85 in bfabric/src/bfabric/engine/engine_suds.py

View workflow job for this annotation

GitHub Actions / Unit Tests

Type of "response" is Any (reportAny)
except MethodNotFound as e:
raise BfabricRequestError(f"SUDS failed to find save method for the {endpoint} endpoint.") from e
return self._convert_results(response=response, endpoint=endpoint)
Expand Down
4 changes: 3 additions & 1 deletion bfabric/src/bfabric/engine/engine_zeep.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
endpoint: str,
obj: ApiRequestObjectType,
auth: BfabricAuth,
method: str = "read",
page: int = 1,
return_id_only: bool = False,
include_deletable_and_updatable_fields: bool = False,
Expand All @@ -38,6 +39,7 @@
:param obj: a dictionary containing the query, for every field multiple possible values can be provided, the
final query requires the condition for each field to be met
:param auth: the authentication handle of the user performing the request
:param method: the method to use for the request, e.g. "read"
:param page: the page number to read
:param return_id_only: whether to return only the ids of the objects
:param include_deletable_and_updatable_fields: whether to include the deletable and updatable fields
Expand Down Expand Up @@ -69,7 +71,7 @@

client = self._get_client(endpoint)
with client.settings(strict=False, xml_huge_tree=True, xsd_ignore_sequence_order=True):
response = client.service.read(full_query)
response = getattr(client.service, method)(full_query)

Check warning on line 74 in bfabric/src/bfabric/engine/engine_zeep.py

View workflow job for this annotation

GitHub Actions / Unit Tests

Type of "response" is Any (reportAny)
return self._convert_results(response=response, endpoint=endpoint)

def save(
Expand Down
Loading