kolena.initialize
Legacy Warning
Content in this section reflects outdated practices or deprecated features. It's recommended to avoid using these in new developments.
While existing implementations using these features will continue to receive support, we strongly advise adopting the latest standards and tools for new projects to ensure optimal performance and compatibility. For more information and up-to-date practices, please refer to our newest documentation at docs.kolena.io.
initialize(*args, api_token=None, verbose=False, proxies=None, **kwargs)
#
Initialize a client session.
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:
- Directly through the
api_token
keyword argument - Populate the
KOLENA_TOKEN
environment variable - Store in
.netrc
file
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]
Exception[MissingTokenError]
Start --> Step1
Step1 -->|No| Step2
Step2 -->|No| Step3
Step3 -->|No| Exception
Step1 -->|Yes| End
Step2 -->|Yes| End
Step3 -->|Yes| End
Note
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)
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_token
|
Optional[str]
|
Optionally provide an API token, otherwise attempts to find a token in |
None
|
verbose
|
bool
|
Optionally configure client to run in verbose mode, providing more information about execution. All logging events are emitted as Python standard library |
False
|
proxies
|
Optional[Dict[str, str]]
|
Optionally configure client to run with |
None
|
Raises:
Type | Description |
---|---|
InvalidTokenError
|
The provided |
InputValidationError
|
The provided combination or number of args is not valid. |
MissingTokenError
|
An API token could not be found. |