Single Transfer: Unlimited Source
One of three transfer variants. This one has no source container; source_entity_id makes the
entity itself the source, so nothing is decremented. See
Introduction to Transfers for the concepts, and
Source Container or
Non-Empty Container for the variants that
draw from a real container.
This example uses the V3 API through the V3 Python SDK.
container.transfer is stable, but unit.list, which this example uses to look up unit IDs, is
beta. Set early_access="true" on the client, as below, or send the EARLY-ACCESS: true header on
raw HTTP requests. See the V3 Stability Guidelines.
Imports and config
Import the SDK and the two input models this example needs, and read the tenant URL and API key from the environment rather than hard-coding them. Then initialize the client with
early_access="true".Look up unit IDs
V3 measurements name their unit by ID, not by a symbol like
"mL". This helper looks a unit up by name withunit.list.Destination and source
Both are fixed API IDs for demonstration. Neither needs fetching, because the source is an entity, not a container whose quantity has to be read.
Perform the transfer
The
SingleTransferInputsetssource_entity_idrather thansource_container_id, which is what makes the source unlimited.source_concentrationsets the entity’s concentration, here 25%. Because the destination is empty, it ends up holding the entity at 25%, as the V2 version of this recipe did. Leavesource_concentrationout and the concentration isn’t tracked.container.transferstarts an async task, andwait_for_task_responsepolls it until it finishes.