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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file truto_python_sdk-0.1.1.tar.gz
.
File metadata
- Download URL: truto_python_sdk-0.1.1.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc30120559a6aa411f2c21e800414da2455820bf4558854015d2abaee8b91589 |
|
MD5 | 09b86da2f6a831831bf0c93a73563530 |
|
BLAKE2b-256 | 2bc7f1882da84c3506781c0a98501e04ab3be937ce809341508f21d0c69295d0 |
File details
Details for the file truto_python_sdk-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: truto_python_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ead995ab0ba4039cc2fe36a3f7b17fb0d40861b581cbdf052e0bdb4173798c25 |
|
MD5 | 9a4c30579a2da2a3ab110225dcc8b4c2 |
|
BLAKE2b-256 | e644dcedd0b984b038673b2a22ec14be789d517e28bd4c5adb15723f9b0cdff8 |