Single Transfer: Transfer Into Non-Empty Container
One of three transfer variants. See Introduction to Transfers for the concepts, and Source Container or Unlimited Source for the other two.
This example uses the V3 API through the
V3 Python SDK. container.get and container.transfer
are stable, so the client doesn’t need early_access.
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.
Destination and source
Both containers are fetched here, not just the source. The destination is not empty, so this prints its contents before the transfer for comparison.
Transfer quantity
A fixed 5mL rather than the source’s full volume. V3 measurements take a unit ID, so this reuses the unit of the source container’s quantity, which is mL in this example.
Perform the transfer
V3 transfers have no
destination_contents, so the request only names the destination, the source container, and the quantity. V3 works out the combined contents and recalculates their concentrations itself.container.transferstarts an async task, andwait_for_task_responsepolls it until it finishes.Check the result
Read the destination again to see the contents and concentrations it holds after the transfer.
Diluting in the same transfer
To top the destination up to a target volume as part of the transfer, set final_quantity. V3
recalculates every concentration for the final volume, so a dilution into a non-empty container
takes one transfer rather than a transfer and a separate update:
final_quantity has to be at least the destination’s existing quantity plus the transfer quantity.
A lower value is accepted, but the task fails with “Your request is invalid”, which
wait_for_task_response raises as a TaskFailureException.