Skip to content

Install Avalanchio Python SDK

Avalanchio Python SDK is python wheel package which wraps the Avalanchio REST API services.

Download and Install

It requires python version 3.8 or above. You can check the python version.

$ python -version

Link for the wheel file https://packages.avalanchio.com/RemoteAgentInstaller/

Download the latest version of the AIO CLI application from the above link. and install using pip.

For isolated setup, you can consider using virtualenv

$ virtualenv venv
$ source venv/bin/activate

The actual file name in the command below is likely to be different from the one below.

$ pip install ./avalanchio_client-0.30.12-py3-none-any.whl

Configure Credentials and Endpoint

Generate authorization token by visiting your user profile in Web application.

Create a directory "aio" in the current user’s home folder. If you want to use a different directory, please create an environment variable "AIO_HOME" and point to it. We will refer to this location as $AIO_HOME in the rest of the document.

Initialize AIO HOME directory

$ mkdir -p $HOME/aio

Create Configuration File

Configuration file (avalanchio.ini) contains authentication configuration for the connecting to Avalanchio API.

Create a file $HOME/aio/avalanchio.ini with configuration with the below content. You can in fact create multiple profiles to connect to multiple avalanchio instances. Update the base url configuration.

Default location of the configuration is $HOME/aio/avalanchio.ini. But if the file is present in any other you can specify the file path using environment variable: AIO_CONF_FILE

[DEFAULT]
authorization=eyJhbGciOiJIUzI1NiJ9.eyJzdW...
base_url=https://test.avalanchio.com
Property Description
base_url Server address that hosts the Avalanchio API. For example, https://test.avalanchio.com
authorization Enter the authorization code generated from the UI. Go to “/user-profile”, then click on Session, then click on “Create API Token”

Environment Variables

Environment Variable Description
AIO_CONF_FILE Specify the path avalanchio configuration file. It contains username, password, base_url etc.
AIO_SSL_VERIFY If the base_url is secure (https://) and you do not have the certificate to connect the secure endpoint, use this option to stop SSL certification verification.
AIO_SUPPRESS_WARNING If AIO_SSL_VERIFY=true, python shows a warning message "InsecureRequestWarning: Unverified HTTPS request is being made to host. Adding certificate verification is strongly advised.". To hide these warnings, set the value to true.
AIO_LOG_LEVEL Set logging level of the avalanchio SDK. Default value: WARN.

Test The Connection

Show token

$ aio auth show-token
Bearer: eyJhbGciOiJIUzUxMiJ9.eyJzdW... (truncated)

Check connection status. If the token is invalid or base_url is invalid, then you will get an error.

$ aio status
User: User(email=<current user’s email>, name=<current user’s name>)

Check version

$ aio version

Once the SDK is intalled, you can update the SDK to the latest version using the following command.

$ aio update