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.2.tar.gz (7.6 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.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: truto_python_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for truto_python_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b6d505478e78eded3b5b93e2df6f724679a7aefee306c42af3053779aa9db97b
MD5 82377bf9b82545eb90a72f2e9d5ada7d
BLAKE2b-256 c9dcc1c49bcc53975b462580e91d199a614e2bf0b54e4b7f20c1e2851cdd6b0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: truto_python_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for truto_python_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee508b2b7a6e36149f265c8003b2178cb21ef857f2c5cd9c075d5514bb7dffea
MD5 1f339c44c28ec806dfe17a48016a5791
BLAKE2b-256 05f0a763383798c32b3f4d3f27a08df1ece8cbef84cd76c661ee59e01c8faf13

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