Getting Started with Indico's Python Client

Requires Python 3.8+

Installing and Upgrading the Python Client Library

To install:

pip install indico-client

To upgrade:

pip install --upgrade indico-client

Afterward, proper installation can be verified with the following in a Python shell:

import indico  
print(indico.**version**)

Authentication

Obtaining an API Token

Download a token from your Account module in the Intake app by clicking the large, blue “Download New API Token” button.

Most browsers will download the API token as indico_api_token.txt and place it in your Downloads directory. We suggest moving the token file from Downloads to either your home directory or another location in your development environment.

Configuration

Environment Variables

You can use environment variables to control the default configuration of the Python Client Library as follows:

Environment VariableDescription
INDICO_HOSTHostname for your Indico Platform. app.indico.io. by default, but likely different for your install.
INDICO_API_TOKEN_PATHPlease provide the full path to your indico_api_token.txt file. The Python Client Library will look for the token file in your home directory by default.

IndicoConfig Class

The IndicoConfig class gives you the maximum control over Python Client Library configuration. Here’s how you might instantiate an IndicoConfig object and set the host and token path:

from indico import IndicoClient, IndicoConfig
my_config = IndicoConfig(  
    host='app.mycompany.com',  
    api_token_path='path/to/indico_api_token.txt'  
)

API Client

The Indico Platform uses GraphQL to communicate with ALL clients, including the company’s own web application and the Indico Python Client. You’ll use an IndicoClient object to pass GraphQL queries to the Indico Platform. Here’s a simple way to create a client:

client = IndicoClient()

The IndicoClient constructor will read configuration options from the environment variables described above. If you would like to set configuration options in an IndicoConfig object manually, then you can pass your config to IndicoClient as follows:

client = IndicoClient(config=my_config)

Indico GraphQL Schema

The Indico Platform ships with a built-in sandbox environment that documents and allows you to interactively explore the Platform’s GraphQL schema. You can find the sandbox at /graph/api/graphql on your Indico Platform installation. If your Platform’s host is indico.my_company.com then the full sandbox URL would be https://indico.my_company.com/graph/api/graphql

Pre-Built GraphQL queries

GraphQL is extremely powerful, flexible, and efficient but can be verbose. To make things easier for day-to-day use of the Platform and Client Library, the developers at Indico created a collection of Python Classes to generate the most often-used queries for you. The collection is documented in the GraphQL section of the Client Library Docs.