Skip to navigation

Single Transfer: Source Container

Transfer the entire contents of one container into an empty destination 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.

  1. 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_url is the tenant root; the SDK adds /api/v3 itself.

  2. Destination and source

    The destination is just an API ID, but the source has to be fetched, because the transfer needs its quantity.

  3. 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.

  4. Perform the transfer

    Each SingleTransferInput names the destination, exactly one source, and the quantity. There is no destination_contents to build: V3 copies every content of the source, at its concentration in the source, into the destination. source_concentration can’t be set on a container-to-container transfer. container.transfer takes a list of them and starts an async task; wait_for_task_response polls it and raises TaskFailureException if it fails. See Async tasks.

import os
from benchling_v3_sdk import Benchling, MeasurementInput, SingleTransferInput
TENANT_URL = os.environ.get("TENANT_URL")
API_KEY = os.environ.get("API_KEY")
benchling = Benchling(base_url=TENANT_URL, api_key=API_KEY)
destination = "con_W5llmhfe"
source_well = benchling.container.get("con_m4AXFaoE")
quantity = MeasurementInput(
value=source_well.quantity.value,
unit_id=source_well.quantity.unit.id,
)
link = benchling.container.transfer(
transfers=[
SingleTransferInput(
destination_container_id=destination,
source_container_id=source_well.id,
transfer_quantity=quantity,
)
]
)
task = benchling.wait_for_task_response(link)
print(task.result.destination_container_ids)