Skip to content


initialize(*args, api_token=None, verbose=True, proxies=None, **kwargs) #

Initialize a client session.


It is often not necessary to call kolena.initialize() directly. When a function requiring initialization is called, this method will be called to initialize a session with any token found in your environment.

A session has a global scope and remains active until interpreter shutdown.

Retrieve an API token from the Developer page and make it available through one of the following options before initializing:

  1. Directly through the api_token keyword argument

    import kolena

  2. Populate the KOLENA_TOKEN environment variable and call kolena.initialize():

    export KOLENA_TOKEN="********"

  3. Store in your .netrc file before calling kolena.initialize():

    machine password ********

flowchart TD
    Start[Get API token]
    Step1{{api_token argument provided?}}
    Step2{{KOLENA_TOKEN environment variable set?}}
    Step3{{Token in .netrc file?}}
    End[Use as API token]
    Start --> Step1
    Step1 -->|No| Step2
    Step2 -->|No| Step3
    Step3 -->|No| Exception
    Step1 -->|Yes| End
    Step2 -->|Yes| End
    Step3 -->|Yes| End


As of version 0.29.0: the entity argument is no longer needed; the signature initialize(entity, api_token) has been deprecated and replaced by initialize(api_token).


Name Type Description Default
api_token Optional[str]

Directly provide an API token, otherwise attempts to find a token in $KOLENA_TOKEN or your .netrc file. This token is a secret and should be treated with caution.

verbose bool

Run the client in verbose mode, providing more information about execution. All logging events are emitted as Python standard library logging events from the "kolena" logger as well as to stdout/stderr directly.

proxies Optional[Dict[str, str]]

Run the client with http or https proxies. The proxies parameter is passed through to the requests package and can be configured accordingly.



Type Description

The provided api_token is not valid.


The provided combination or number of args is not valid.


An API token could not be found.