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
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
Hashes for trustedtwin-3.3.20230815100758.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61104994e3ce2bb316fdf4dcc9a16695dad7929ceffe76059b415d71ed267add |
|
MD5 | 64f8f3cb8bce1f0fda279b3e2930e216 |
|
BLAKE2b-256 | f1b5b1cf3b42752cc765af18138c5e614697d37d85d4697514f9ffbe8551bc20 |
Hashes for trustedtwin-3.3.20230815100758-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77c46d1e0043fc4ed35f0fd33310b2779953e7b6598b57a92457b384c55f5d73 |
|
MD5 | ac962f82739a0737cd66235ee492cc3d |
|
BLAKE2b-256 | 421075c40ef12b7ec2cd1fab8cf11df3ecabaaef8150f3fa84bd5c797d8893bb |