Skip to content

Label Maker

Generate printable QR/barcode labels for items and locations.

LabelMakerClient

Sub-client for printable label generation endpoints.

Accessed via HomeboxClient.labelmaker.

Source code in homebox/client.py
class LabelMakerClient:
    """Sub-client for printable label generation endpoints.

    Accessed via ``HomeboxClient.labelmaker``.
    """

    def __init__(self, client: HomeboxClient):
        """Initialise the labelmaker sub-client with the shared root client."""
        self.client = client

    def get_asset_label(self, id: str, print: bool | None = None) -> bytes:
        """Return a printable label for an asset identified by its asset ID.

        Args:
            id: Asset ID string.
            print: When ``True`` the server returns a print-ready version of the
                label.

        Returns:
            bytes: Label content (typically SVG or HTML).
        """
        params = {}
        if print:
            params["print"] = print
        return self.client._get(f"/v1/labelmaker/asset/{id}", params=params, binary=True)

    def get_item_label(self, id: str, print: bool | None = None) -> bytes:
        """Return a printable label for an item.

        Args:
            id: UUID of the item.
            print: When ``True`` the server returns a print-ready version of the
                label.

        Returns:
            bytes: Label content (typically SVG or HTML).
        """
        params = {}
        if print:
            params["print"] = print
        return self.client._get(f"/v1/labelmaker/item/{id}", params=params, binary=True)

    def get_location_label(self, id: str, print: bool | None = None) -> bytes:
        """Return a printable label for a location.

        Args:
            id: UUID of the location.
            print: When ``True`` the server returns a print-ready version of the
                label.

        Returns:
            str: Label content (typically SVG or HTML).
        """
        params = {}
        if print:
            params["print"] = print
        return self.client._get(f"/v1/labelmaker/location/{id}", params=params, binary=True)

__init__

__init__(client: HomeboxClient)

Initialise the labelmaker sub-client with the shared root client.

Source code in homebox/client.py
def __init__(self, client: HomeboxClient):
    """Initialise the labelmaker sub-client with the shared root client."""
    self.client = client

get_asset_label

get_asset_label(id: str, print: bool | None = None) -> bytes

Return a printable label for an asset identified by its asset ID.

Parameters:

Name Type Description Default
id str

Asset ID string.

required
print bool | None

When True the server returns a print-ready version of the label.

None

Returns:

Name Type Description
bytes bytes

Label content (typically SVG or HTML).

Source code in homebox/client.py
def get_asset_label(self, id: str, print: bool | None = None) -> bytes:
    """Return a printable label for an asset identified by its asset ID.

    Args:
        id: Asset ID string.
        print: When ``True`` the server returns a print-ready version of the
            label.

    Returns:
        bytes: Label content (typically SVG or HTML).
    """
    params = {}
    if print:
        params["print"] = print
    return self.client._get(f"/v1/labelmaker/asset/{id}", params=params, binary=True)

get_item_label

get_item_label(id: str, print: bool | None = None) -> bytes

Return a printable label for an item.

Parameters:

Name Type Description Default
id str

UUID of the item.

required
print bool | None

When True the server returns a print-ready version of the label.

None

Returns:

Name Type Description
bytes bytes

Label content (typically SVG or HTML).

Source code in homebox/client.py
def get_item_label(self, id: str, print: bool | None = None) -> bytes:
    """Return a printable label for an item.

    Args:
        id: UUID of the item.
        print: When ``True`` the server returns a print-ready version of the
            label.

    Returns:
        bytes: Label content (typically SVG or HTML).
    """
    params = {}
    if print:
        params["print"] = print
    return self.client._get(f"/v1/labelmaker/item/{id}", params=params, binary=True)

get_location_label

get_location_label(id: str, print: bool | None = None) -> bytes

Return a printable label for a location.

Parameters:

Name Type Description Default
id str

UUID of the location.

required
print bool | None

When True the server returns a print-ready version of the label.

None

Returns:

Name Type Description
str bytes

Label content (typically SVG or HTML).

Source code in homebox/client.py
def get_location_label(self, id: str, print: bool | None = None) -> bytes:
    """Return a printable label for a location.

    Args:
        id: UUID of the location.
        print: When ``True`` the server returns a print-ready version of the
            label.

    Returns:
        str: Label content (typically SVG or HTML).
    """
    params = {}
    if print:
        params["print"] = print
    return self.client._get(f"/v1/labelmaker/location/{id}", params=params, binary=True)