Skip to main content

Trusted Twin Python client

Project description

TrustedTwin Python Client

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.

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

trustedtwin-3.3.20230906150900.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

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

trustedtwin-3.3.20230906150900-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file trustedtwin-3.3.20230906150900.tar.gz.

File metadata

  • Download URL: trustedtwin-3.3.20230906150900.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for trustedtwin-3.3.20230906150900.tar.gz
Algorithm Hash digest
SHA256 fbd73b3b43edca2fa24dab764a2f2dd209dd79ca2c1c66590826098856dcc261
MD5 a3e7b0e5ad3d7d60608ebfcea16328cf
BLAKE2b-256 8f22ce016bd1758bc6d0ae6b81eaaa7dfcea2f669f28f64f4ae25090df7900bd

See more details on using hashes here.

File details

Details for the file trustedtwin-3.3.20230906150900-py3-none-any.whl.

File metadata

File hashes

Hashes for trustedtwin-3.3.20230906150900-py3-none-any.whl
Algorithm Hash digest
SHA256 512cb3d33770ba7444f3cb7560e8e79d8a8e396cab58af3435795872116822ed
MD5 d470ce1c682d49bcab12ed06d6f8e5a9
BLAKE2b-256 b194e6c6166fae8614f733df9c3d7e72bb274c12bb7e0693916c5510e3029da7

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