Official Python SDK for Forte Platforms
Project description
Forte Platforms Python SDK
Official Python SDK for interacting with the Forte Platforms API.
Installation
pip install forte-sdk
Authentication
Set your API token as an environment variable:
export FORTE_API_TOKEN=your_api_token_here
Or pass it directly when creating the client:
client = ForteClient(api_token="your_api_token_here")
You can generate an API token from the Forte Platforms dashboard.
Quick Start
from forte_sdk import ForteClient
client = ForteClient()
# List your projects
projects = client.projects.list_projects()
# Get a specific project
project = client.projects.get_project(project_id="your-project-id")
Custom Base URL
client = ForteClient(base_url="https://custom-endpoint.example.com")
Error Handling
API errors are raised as exceptions:
from forte_sdk.generated.exceptions import ApiException
try:
project = client.projects.get_project(project_id="invalid-id")
except ApiException as e:
print(f"API error {e.status}: {e.reason}")
User Custom Attributes
Store arbitrary key-value metadata on your users. Useful for tracking subscription tiers, feature flags, preferences, or any application-specific data.
# Set custom attributes on a user
user = client.projects.put_user_custom_attributes(
project_id="your-project-id",
user_id="user-id",
request_body={
"plan": "pro",
"referral_source": "google",
"onboarding_completed": "true",
},
)
print(user.custom_metadata_attributes)
# {'plan': 'pro', 'referral_source': 'google', 'onboarding_completed': 'true'}
Key constraints:
- Keys must be 1-64 characters: letters, numbers, underscores, and hyphens only
- Values are strings
- Each call replaces all existing attributes — include any you want to keep
Merge with existing attributes
# Read current attributes, then merge
user = client.projects.get_project_user(
project_id="your-project-id",
user_id="user-id",
)
client.projects.put_user_custom_attributes(
project_id="your-project-id",
user_id="user-id",
request_body={
**user.custom_metadata_attributes,
"plan": "enterprise", # update one field
},
)
API Reference
client.projects
Manage projects and services on Forte Platforms.
client.users
Manage end-users within your projects.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file forte_sdk-1.0.8.tar.gz.
File metadata
- Download URL: forte_sdk-1.0.8.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8af06b694a6fefb3e4dd94d49a19aaa2a79dc71b9035f7b9d06ca502b1a76077
|
|
| MD5 |
87bd0758afad7cc770f0da9bc72a38cc
|
|
| BLAKE2b-256 |
1c278c38d85d694c7186a23407407aa848b198582f4cc07561b3f6d52bb3596a
|
File details
Details for the file forte_sdk-1.0.8-py3-none-any.whl.
File metadata
- Download URL: forte_sdk-1.0.8-py3-none-any.whl
- Upload date:
- Size: 94.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74fe655b7b71bed876faa32f7c5106a35ada0717d455c2b88cf3eb48dfb70429
|
|
| MD5 |
c0b759f0659daf231b4bdff4c20bf63d
|
|
| BLAKE2b-256 |
01be9f6dce0edfe0a32f8992eabeedd1157c127d4a3a3cb476fff0fdc0b1745a
|