TCM Automation Docs

Python SDK reference

PyPI package mitra-tcm-sdk. Single dep on requests. Python 3.9+.

Install

pip install mitra-tcm-sdk

Construct a client

from tcm import Client

client = Client(
    base_url=os.environ["TCM_BASE_URL"],
    token=os.environ["TCM_TOKEN"],
)

Methods

Method
client.create_run(input)
client.get_run(run_id)
client.list_run_executions(run_id)
client.record_result(exec_id, input)
client.upload_attachment(exec_id, name, ct, data)

Errors

Non-2xx responses raise tcm.APIError with status, code, and message attributes.

from tcm import APIError

try:
    client.get_run("…")
except APIError as e:
    if e.status == 401:
        ...  # bad / revoked token