Skip to main content

Trusted Twin Python client

Project description

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.

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.20231221064307.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

trustedtwin-3.3.20231221064307-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for trustedtwin-3.3.20231221064307.tar.gz
Algorithm Hash digest
SHA256 68e0666410c58b3b22d7e7bd373351efe811ded172d00ba8a977b8588780021c
MD5 96d3c1688ced391aa2d8e8fc0c84e3f0
BLAKE2b-256 79c3ff7f160df36755fe8b3591bdb4949c15ef08f535745f95f8c42e943ed15b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for trustedtwin-3.3.20231221064307-py3-none-any.whl
Algorithm Hash digest
SHA256 d1ad03f3f4295c9611b7b07d05ed056a209a7f28aaf4931d8715c7991608ebf7
MD5 5c6143df0c0c877fa6426e367d7481c8
BLAKE2b-256 a27d11f1d80ec521f268ebb7e69931011e907dc925c5c800d189e8349896a9d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page