Official Python SDK for Chatiss Open Platform
Project description
Chatiss Open SDK
Official Python SDK for Chatiss Open Platform.
Features
- Sync client:
OpenAPIClient - Async client:
AsyncOpenAPIClient - Automatic JWT token acquisition and refresh
- Structured API response models
- Unified exception model
- SSE stream support for tongue analysis API
Installation
pip install chatiss-open-sdk
Quick Start (Sync)
from chatiss_open_sdk import SDKConfig, OpenAPIClient
from chatiss_open_sdk.types import TongueCreateRequest
config = SDKConfig(
access_key_id="your_access_key_id",
access_key_secret="your_access_key_secret",
)
with OpenAPIClient(config) as client:
token_resp = client.get_jwt_token()
print(token_resp.status)
req = TongueCreateRequest(
original_img="https://example.com/original.png",
skin_img="https://example.com/skin.png",
gender=1,
birthday="1990-01-01",
use_flash=True,
)
for event in client.tongue_create(req):
print(event.event, event.data.status)
Quick Start (Async)
import asyncio
from chatiss_open_sdk import SDKConfig, AsyncOpenAPIClient
from chatiss_open_sdk.types import TongueCreateRequest
async def main():
config = SDKConfig(
access_key_id="your_access_key_id",
access_key_secret="your_access_key_secret",
)
async with AsyncOpenAPIClient(config) as client:
req = TongueCreateRequest(
original_img="https://example.com/original.png",
skin_img="https://example.com/skin.png",
gender=1,
birthday="1990-01-01",
use_flash=True,
)
async for event in client.tongue_create(req):
print(event.event, event.data.status)
asyncio.run(main())
Error Handling
- Business failures (
status == "FAIL") are returned inAPIResponse - Network failures raise
NetworkError - Auth failures raise
AuthError - Protocol/schema failures raise
ProtocolError - SSE interruption raises
SSEStreamError
License
MIT
See LICENSE for the full text.
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
chatiss_open_sdk-0.1.0.tar.gz
(12.3 kB
view details)
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 chatiss_open_sdk-0.1.0.tar.gz.
File metadata
- Download URL: chatiss_open_sdk-0.1.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
026ca3b60b0959736a177a1373580b636f00853a04910e91757375a8687e5a68
|
|
| MD5 |
e6bf0289729f50f753cdf6dde2d06682
|
|
| BLAKE2b-256 |
4c871abb465a915f2a826646d270ab722b42ab7f782141cd1a9aaa1d05adc883
|
File details
Details for the file chatiss_open_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chatiss_open_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19e12a1fb6bfca4bbd05f2b6f473b848433eec60b48b214988dcb02b6450902d
|
|
| MD5 |
c2d610ebe13bcbde546ed2ac5c348a6a
|
|
| BLAKE2b-256 |
40a8e9ca35dd48f242452fde507a597534baa078033102926956d9d1e96282f3
|