labthings_fastapi.client.outputs

Module Contents

Classes

ClientBlobOutput

An output from LabThings best returned as a file

API

class labthings_fastapi.client.outputs.ClientBlobOutput(media_type: str, href: str, client: Optional[httpx.Client] = None)

An output from LabThings best returned as a file

This object is returned by a client when the output is not serialised to JSON. It may be either retrieved to memory using .content, or saved to a file using .save().

Initialization

media_type: str

None

download_url: str

None

property content: bytes

Return the the output as a bytes object

save(filepath: str) None

Save the output to a file.

This may remove the need to hold the output in memory, though for now it simply retrieves the output into memory, then writes it to a file.

open() io.IOBase

Open the output as a binary file-like object.