Skip to main content

Credentials Guide

Initialize the SDK

Before initializing the SDK, you will need to put your credential file to the correct directory. When you receive access to the SDK, you will be provided with instructions of how to do this.

The TSDK (Treble SDK) is what is used to initialize your SDK instance.

# Import the SDK class.
from treble_tsdk.tsdk import TSDK
# The tsdk_namespace provides convenient access to most SDK classes/variables.
# Here we import the tsdk_namespace as 'treble'.
from treble_tsdk import tsdk_namespace as treble
# The display_data module provides functions that can be used to display many SDK datastructures as trees or tables.
# Here we import the display_data module as 'dd'.
from treble_tsdk import display_data as dd

# Initialize the SDK (for this you will need credentials)
tsdk = TSDK()

When you create a SDK object the SDK will load your credentials and check if there are any updates available to the SDK package. We strongly recommend that you try and keep your SDK package up-to-date if possible.

We recommend to use the .cred file when logging in to the SDK, but it is also possible to supply the credential string when logging in to the sdk.


Login using .cred file

When you create a TSDK object it will search for a .cred file in a few locations, depending on your operation system, please put the .cred file in the correct directory.

Windows: %HOME%/AppData/Local/treble/tsdk/tsdk.cred and %HOME%/AppData/Roaming/treble/tsdk/tsdk.cred
Linux: ~/.config/treble/tsdk.cred
Macos: ~/.config/treble/tsdk.cred and ~/Library/ApplicationSupport/treble/tsdk.cred

You can then create a TSDK object like so:

from treble_tsdk.tsdk import TSDK
tsdk = TSDK()

If you prefer, you can also point it to a custom credentials file location.

from treble_tsdk.tsdk import TSDK, TSDKCredentials
tsdk = TSDK(TSDKCredentials.from_file("/path/to/cred/file.cred"))

Login using credential string

You can also login using the credentials string.

from treble_tsdk.tsdk import TSDK, TSDKCredentials
tsdk = TSDK(TSDKCredentials("MY CREDENTIALS"))

It is also possible to set the credentials as an environment variable and the SDK will detect and use it. You will need to create an environment variable with your credential string called TSDK_CREDENTIALS. F.ex. in linux/macos terminal you can do:

export TSDK_CREDENTIALS="MY CREDENTIALS"

And then you can login to the SDK like so:

from treble_tsdk.tsdk import TSDK
tsdk = TSDK()