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:
- Upload a tt_api.yaml file corresponding with the respective API version.
- In the Gitlab interface in the left-hand side pane, select Build and go to the Pipeline schedules section.
- By the Deploy to official pyPi repository schedule, click on the Run pipeline schedule button.
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 trustedtwin-3.11.20240110220722.tar.gz
.
File metadata
- Download URL: trustedtwin-3.11.20240110220722.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db49ee2a36c5e276628dcbbc01fb0b475e8fe4225e5dcac9d59a4912392dee8a |
|
MD5 | 02a3b61d467aaa557a4a9ccbc8d1c7b9 |
|
BLAKE2b-256 | bde45a57e137b04d556ac4c3ff849c203717365a063a4ad49f1065cdb0000ee0 |
File details
Details for the file trustedtwin-3.11.20240110220722-py3-none-any.whl
.
File metadata
- Download URL: trustedtwin-3.11.20240110220722-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a442273b25ffcb1127b403a3dc8aa0f0993cf470dddbd8f559068347bbc887f5 |
|
MD5 | 5bb9a6c8506ee56d81365841ebd422c0 |
|
BLAKE2b-256 | 55a9c59d64eb98df89ec9d2afe27a500b1b0379236b299176d44971e717122d2 |