Python SDK for the AHS CTI Platform
Project description
AHS CTI Python SDK
Python SDK for the AHS CTI Platform — initiate and control outbound calls via REST API.
Requirements: Python ≥ 3.9 · httpx ≥ 0.25
Installation
pip install ahs-cti-api-sdk
Quick Start
API-Key Authentication (recommended for server integrations)
from ahs_cti import CtiClient
with CtiClient(base_url="https://cti.example.com", api_key="ctsk_...", tenant_id=1) as client:
result = client.calls.dial("+919876543210")
print(result.call_id) # save this for end_call
end = client.calls.end_call(
result.call_id,
disposition="INTERESTED",
list_comments="Customer wants a demo next week",
)
print(end.duration)
Credential Authentication
from ahs_cti import CtiClient
with CtiClient(base_url="https://cti.example.com", user_id="agent1", password="secret") as client:
result = client.calls.dial("+919876543210", caller_id="AH2007C")
Async Client
import asyncio
from ahs_cti import AsyncCtiClient
async def main():
async with AsyncCtiClient(base_url="https://cti.example.com", api_key="ctsk_...") as client:
result = await client.calls.dial("+919876543210")
print(result.call_id)
asyncio.run(main())
ClientConfig Reference
For full control over transport settings, use ClientConfig:
from ahs_cti import CtiClient, ClientConfig
config = ClientConfig(
base_url="https://cti.example.com",
timeout=15.0,
verify_ssl=False, # for self-signed certificates
max_retries=5,
)
with CtiClient(config=config, api_key="ctsk_...") as client:
result = client.calls.dial("+919876543210")
| Parameter | Type | Default | Description |
|---|---|---|---|
base_url |
str |
required | Root URL of the CTI platform |
timeout |
float |
30.0 |
Request timeout in seconds |
verify_ssl |
bool |
True |
Set False for self-signed certs |
max_retries |
int |
3 |
Retry attempts on 5xx / network errors |
Error Handling
from ahs_cti import CtiClient, CtiAuthError, CtiApiError, CtiRetryExhaustedError
with CtiClient(...) as client:
try:
result = client.calls.dial("+919876543210")
except CtiAuthError:
# Invalid or expired API key / credentials
print("Authentication failed")
except CtiRetryExhaustedError as e:
# All retry attempts failed (5xx or network)
print(f"Failed after {e.attempts} attempts: {e.last_exc}")
except CtiApiError as e:
# Any other API error (400, 404, 422 …)
print(f"API error [{e.status_code}]: {e}")
Exception Hierarchy
CtiError
├── CtiAuthError — 401 / login failure
└── CtiApiError — 4xx / 5xx from the platform
└── CtiRetryExhaustedError — all retries exhausted
Retry Behaviour
The SDK automatically retries on 500, 502, 503, 504 responses and transient
network errors (ConnectError, TimeoutException). Retries use exponential backoff:
| Attempt | Delay |
|---|---|
| 1st (initial) | none |
| 2nd retry | 2 s |
| 3rd retry | 4 s |
| 4th retry | 8 s |
Set max_retries=0 in ClientConfig to disable retries entirely.
Self-Signed Certificates
Internal / staging servers often use self-signed TLS certificates. Pass verify_ssl=False:
client = CtiClient(base_url="https://192.168.1.10:8082", api_key="ctsk_...", verify_ssl=False)
Do not disable SSL verification in production.
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 ahs_cti_api_sdk-0.1.0a5.tar.gz.
File metadata
- Download URL: ahs_cti_api_sdk-0.1.0a5.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efcb718f48f071781489691b0a4868b1ed58732e5efe05a47a72be14d837fbec
|
|
| MD5 |
733cdbfa50e25b3165c9538b0c45f201
|
|
| BLAKE2b-256 |
7beb407d564e4f120f6edfdaaea684f9189784cc5351ec8c306f9a85d414c31c
|
Provenance
The following attestation bundles were made for ahs_cti_api_sdk-0.1.0a5.tar.gz:
Publisher:
publish-python.yml on Achala-CTI/ahs-cti-api-sdks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ahs_cti_api_sdk-0.1.0a5.tar.gz -
Subject digest:
efcb718f48f071781489691b0a4868b1ed58732e5efe05a47a72be14d837fbec - Sigstore transparency entry: 1602357024
- Sigstore integration time:
-
Permalink:
Achala-CTI/ahs-cti-api-sdks@b80f0fa58d038fa147699d37fb2a72642adba9bd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Achala-CTI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@b80f0fa58d038fa147699d37fb2a72642adba9bd -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ahs_cti_api_sdk-0.1.0a5-py3-none-any.whl.
File metadata
- Download URL: ahs_cti_api_sdk-0.1.0a5-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb57d4b7ae1e82a9c4c24f7cc30830e584a205bdcfd9c7497f333ce42bb68250
|
|
| MD5 |
60b017af1a751261d4ed64f10b7373f1
|
|
| BLAKE2b-256 |
097456d118b0247abb8a0ad42d3ef6682c3785b47e7e4bf70e53c25783eefdcc
|
Provenance
The following attestation bundles were made for ahs_cti_api_sdk-0.1.0a5-py3-none-any.whl:
Publisher:
publish-python.yml on Achala-CTI/ahs-cti-api-sdks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ahs_cti_api_sdk-0.1.0a5-py3-none-any.whl -
Subject digest:
bb57d4b7ae1e82a9c4c24f7cc30830e584a205bdcfd9c7497f333ce42bb68250 - Sigstore transparency entry: 1602357472
- Sigstore integration time:
-
Permalink:
Achala-CTI/ahs-cti-api-sdks@b80f0fa58d038fa147699d37fb2a72642adba9bd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Achala-CTI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@b80f0fa58d038fa147699d37fb2a72642adba9bd -
Trigger Event:
workflow_dispatch
-
Statement type: