Single Transfer: Source Container
One of three transfer variants. See Introduction to Transfers for the concepts, and Unlimited Source or Non-Empty Container 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.
base_urlis the tenant root; the SDK adds/api/v3itself.Destination and source
The destination is just an API ID, but the source has to be fetched, because the transfer needs its quantity.
Transfer quantity
This example moves the source container’s entire contents, so the transfer quantity is built to match the source container’s own quantity exactly. V3 measurements take a unit ID rather than a unit symbol, so reuse the ID from the source’s
quantity.Perform the transfer
Each
SingleTransferInputnames the destination, exactly one source, and the quantity. There is nodestination_contentsto build: V3 copies every content of the source, at its concentration in the source, into the destination.source_concentrationcan’t be set on a container-to-container transfer.container.transfertakes a list of them and starts an async task;wait_for_task_responsepolls it and raisesTaskFailureExceptionif it fails. See Async tasks.