Skip to main content

Python3 SDK for the Truto API

Project description

truto-python-sdk

truto-python-sdk is a Python SDK to interact with the Truto API, a powerful integration platform for connecting multiple SaaS applications. The SDK mirrors the Truto REST API endpoints, which are documented in the Truto Postman Collection.

Run in Postman

Requires

Python 3.8+

Installation

Install the package via pip:

pip install truto-python-sdk

Usage

import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    # Fetch all installed integrations for the environment
    installed_integrations = truto_api.environment_integrations.list()
    async for integration in installed_integrations:
        print(integration)

    # Fetch integrated accounts for a tenant
    integrated_accounts = truto_api.integrated_accounts.list(tenant_id="acme-1")
    print(await integrated_accounts.to_array())

    # Make a request to the unified API
    unified_cursor = truto_api.unified_api.list(
        "accounting",
        "accounts",
        {
            "integrated_account_id": "766cc1ee-6637-4aa1-a73e-a0c89ccc867c",
            "created_at": "2023-05-01T00:00:00.000Z",
        },
    )
    async for account in unified_cursor:
        print(account)

    unified_resource = await truto_api.unified_api.get(
        "accounting",
        "accounts",
        "1",
        {"integrated_account_id": "766cc1ee-6637-4aa1-a73e-a0c89ccc867c"},
    )
    print(unified_resource)

asyncio.run(main())

List Calls and Pagination

The SDK uses async iterators for list calls. This allows you to iterate through resources without manually handling pagination.

cursor = truto_api.unified_api.list(
    "ticketing",
    "tickets",
    {"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"},
)
async for ticket in cursor:
    print(ticket)

You can also call to_array() to auto-paginate and collect all resources:

tickets = await truto_api.unified_api.list(
    "ticketing",
    "tickets",
    {"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"},
).to_array()

Or fetch one page at a time with next_page():

page = await truto_api.unified_api.list(
    "ticketing",
    "tickets",
    {"integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"},
).next_page()

Additional Endpoints

The SDK also includes endpoints for Custom API, MCP, Workflows, Workflow Runs, Alarms, Static Gates, Sandbox Integrated Accounts, and Webhooks. See full reference in ADVANCED_USAGE.md.

Contributing

We welcome contributions to improve truto-python-sdk. Please submit issues or pull requests on the GitHub repository.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

truto_python_sdk-0.1.5.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

truto_python_sdk-0.1.5-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file truto_python_sdk-0.1.5.tar.gz.

File metadata

  • Download URL: truto_python_sdk-0.1.5.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1018-azure

File hashes

Hashes for truto_python_sdk-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f58c913aba2355d59dbae4094c7d74f3b6ed0e0c65cf897eebc7c9cb400dd054
MD5 b8e21ce789df7e3416fb8a9916f0e2d1
BLAKE2b-256 5d80d0dd2cce7c9cd0060498e379c14faf79e708b6ad55c1efd5a4b788dda8f1

See more details on using hashes here.

File details

Details for the file truto_python_sdk-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: truto_python_sdk-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1018-azure

File hashes

Hashes for truto_python_sdk-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bfc8d834848559bf5f04de58764820316be7df05706130e17eacd6869285678c
MD5 dc171aaca7c3eae357015efb5617e638
BLAKE2b-256 53e35d44027b83fbd598553ffeff1568192cf8d841519e31e88911da12df491e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page