Skip to main content

TrustedTwin Python Client (external info)

The Trusted Twin Python library makes it easy to use the Trusted Twin user infrastructure API in Python applications. The library version is consistent with the Swagger version of the Trusted Twin API.

Client offers synchronous and asynchronous versions which can be used for communication with TT API.

Requirements

Library requires Python3.6+.

Installation

For synchronous API client:

pip install trustedtwin

To use asynchronous client:

pip install trustedtwin[async]

By default, additional packages required by asynchronous version are not installed.

Usage

Authorization

For synchronous client:

from trustedtwin.tt_api import TTRESTService

TT_SERVICE = TTRESTService(auth=$USER_SECRET)

For asynchronous client:

from trustedtwin.tt_api_async import TTAsyncRESTService

TT_SERVICE = TTAsyncRESTService(auth=$USER_SECRET)

Example calls

For synchronous client:

import json 
from trustedtwin.tt_api import TTRESTService

status, response = TTRESTService().create_user_secret($ACCOUNT_UUID, $PIN)
resp = json.loads(response)

TT_SERVICE = TTRESTService(tt_auth=resp['secret'])

_body = {
    'description': {
        'custom_name': 'custom_value'
    }
}

status, response = TT_SERVICE.create_twin(body=_body)
resp = json.loads(response)

For asynchronous client:

import json 
from trustedtwin.tt_api_async import TTAsyncRESTService

status, response = await TTAsyncRESTService().create_user_secret($ACCOUNT_UUID, $PIN)
resp = json.loads(response)

TT_SERVICE = TTAsyncRESTService(tt_auth=resp['secret'])

_body = {
    'description': {
        'custom_name': 'custom_value'
    }
}

status, response = await TT_SERVICE.create_twin(body=_body)
resp = json.loads(response)

For more information please navigate to the official documentation.

TrustedTwin Python Client (internal info)

Updating the library

To update the Python library to the newest version:

  1. Upload a tt_api.yaml file corresponding with the respective API version.
  2. In the Gitlab interface in the left-hand side pane, select Build and go to the Pipeline schedules section.
  3. By the Deploy to official pyPi repository schedule, click on the Run pipeline schedule button.

Release files for trustedtwin 3.17.20240802020817

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trustedtwin 3.17.20240802020817
File Size Uploaded
trustedtwin-3.17.20240802020817.tar.gz 24.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trustedtwin 3.17.20240802020817
File Interpreter ABI Platform
trustedtwin-3.17.20240802020817-py3-none-any.whl Python 3 none any Details

Total release size: 49.3 kB

Release files / trustedtwin-3.17.20240802020817.tar.gz

Download URL trustedtwin-3.17.20240802020817.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bd046d5dedc4d7d475f4f85899282606d7c5baf7869ddabe9389408483ba3d75
BLAKE2b-256 checksum
How to use checksums
887ffc15bf2cb16b0fc41f1abed13a85d3f688ff4e8f0d5075087263b4d18e8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / trustedtwin-3.17.20240802020817-py3-none-any.whl

Download URL trustedtwin-3.17.20240802020817-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1400e5ece0eb24a9f6e66f7f3f30b561a2336843c6858755bfbfbc672018752
BLAKE2b-256 checksum
How to use checksums
f5d3491ee01db96c1a7e81581d1d67e34425f153d4e8963f85c76083e2693881
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page