Client
client
Kaleidoscope API Client Module.
This module provides the main client class for interacting with the Kaleidoscope API, along with a base model class for Kaleidoscope entities.
The KaleidoscopeClient provides access to various service endpoints including:
- activities: Manage activities
- imports: Import data into Kaleidoscope
- programs: Manage programs
- entity_types: Manage entity types
- records: Manage records
- fields: Manage fields
- experiments: Manage experiments
- record_views: Manage record views
- exports: Export data from Kaleidoscope
Attributes:
| Name | Type | Description |
|---|---|---|
PROD_API_URL |
str
|
The production URL for the Kaleidoscope API. |
VALID_CONTENT_TYPES |
list
|
List of acceptable content types for file downloads. |
TIMEOUT_MAXIMUM |
int
|
Maximum timeout for API requests in seconds. |
Example
# instantiate client object
client = KaleidoscopeClient(
client_id="your_client_id",
client_secret="your_client_secret"
)
# retrieve activities
programs = client.activities.get_activities()
PROD_API_URL
module-attribute
PROD_API_URL = 'https://api.kaleidoscope.bio'
The production URL for the Kaleidoscope API.
This is the default url used for the KaleidoscopeClient, in the event
no url is provided in the KaleidoscopeClient's initialization
VALID_CONTENT_TYPES
module-attribute
VALID_CONTENT_TYPES = ['text/csv', 'chemical/x-mdl-sdfile', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']
List of acceptable content types for file downloads.
Any file retrieved by the KaleidoscopeClient must be of one the above types
TIMEOUT_MAXIMUM
module-attribute
TIMEOUT_MAXIMUM = 10
Maximum timeout for API requests in seconds.
TokenResponse
KaleidoscopeClient
A client for interacting with the Kaleidoscope API.
This client provides a high-level interface to various Kaleidoscope services including imports, programs, entity types, records, fields, tasks, experiments, record views, and exports. It handles authentication using API key credentials and provides methods for making HTTP requests (GET, POST, PUT) to the API endpoints.
Attributes:
| Name | Type | Description |
|---|---|---|
activities |
ActivitiesService
|
Service for managing activities. |
dashboards |
DashboardsService
|
Service for managing dashboards. |
workspace |
WorkspaceService
|
Service for workspace-related operations. |
programs |
ProgramsService
|
Service for managing programs. |
labels |
LabelsService
|
Service for managing labels. |
entity_types |
EntityTypesService
|
Service for managing entity types. |
entity_fields |
EntityFieldsService
|
Service for managing entity fields. |
records |
RecordsService
|
Service for managing records. |
record_views |
RecordViewsService
|
Service for managing record views. |
imports |
ImportsService
|
Service for managing data imports. |
exports |
ExportsService
|
Service for managing data exports. |
property_fields |
PropertyFieldsService
|
Service for managing property fields. |
Example
client = KaleidoscopeClient(
client_id="your_api_client_id",
client_secret="your_api_client_secret"
}
# Use the client to interact with various services
programs = client.activities.get_activities()
Sets up the client with API credentials and optional API URL, and initializes service interfaces for interacting with different API endpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client_id
|
str
|
The API client ID for authentication. |
required |
client_secret
|
str
|
The API client secret for authentication. |
required |
url
|
str | None
|
The base URL for the API. Defaults to the production API URL if not provided. |
None
|
Source code in kalpy/client.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |