Skip to content

Commit f6c8976

Browse files
committed
Add a comment explaining ClientBlobOutput in action inputs.
1 parent 46ff8e6 commit f6c8976

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/labthings_fastapi/client/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@ def invoke_action(self, path: str, **kwargs: Any) -> Any:
182182
for k in kwargs.keys():
183183
value = kwargs[k]
184184
if isinstance(value, ClientBlobOutput):
185+
# ClientBlobOutput objects may be used as input to a subsequent
186+
# action. When this is done, they should be serialised to a dict
187+
# with `href` and `media_type` keys, as done below.
188+
# Ideally this should be replaced with `Blob` and the use of
189+
# `pydantic` models to serialise action inputs.
190+
#
191+
# Note that the blob will not be uploaded: we rely on the blob
192+
# still existing on the server.
185193
kwargs[k] = {"href": value.href, "media_type": value.media_type}
186194
r = self.client.post(urljoin(self.path, path), json=kwargs)
187195
r.raise_for_status()

0 commit comments

Comments
 (0)