Skip to main content

Python3 SDK for the Truto API

Project description

truto-python-sdk

Python3 SDK for the Truto API. The SDK mirrors the Truto REST API endpoints which are documented in the Truto Postman Collection.

Run in Postman

Installation

pip install truto-python-sdk

Usage

import asyncio
from truto_python_sdk import TrutoApi

# Initialize the SDK with your token
truto_api = TrutoApi(token="<your_api_token>")

async def main():
    async for ticket in truto_api.unified_api.list("ticketing", "tickets", {
        "integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
    }):
        print(await truto_api.proxy_api.get("ticketing-tickets", ticket["id"], {
            "integrated_account_id": "c54bc595-486e-4bbb-8c17-20810fa4a86c"
        }))

# Run the async function
asyncio.run(main())

List calls and pagination

The SDK uses async generators to handle list calls. This allows you to iterate over the results of a list call without having to worry about pagination. The SDK will automatically fetch the next page of results when needed.

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

You can also call to_array(), which will auto-paginate all the resources and return them as a list.

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

Getting each page of results manually is also possible.

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

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.3.tar.gz (10.3 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.3-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: truto_python_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.12.13 Linux/6.17.0-1010-azure

File hashes

Hashes for truto_python_sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7699c41558a00f39792c7928133408460969483f03c16c79111a8632982b0823
MD5 97c8199f4844a3d045c547f93d50ade5
BLAKE2b-256 5a010534c9076fde9b7e9e7f9e79003f820f31d566188d7b900ad0281f67d4e7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for truto_python_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 401f5767206049c7d74a9633217f0efb01042cc5896c4862553c6f65ce25dbd4
MD5 bab082129e4695c2077cf9f1fa165ac2
BLAKE2b-256 8f8ccdf602d7bdf27f0b9680c6ed36f2a86d7a3288853ff7834ee49a80e19745

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