Skip to main content

Shared core for Teamver SDKs: async transport, unified errors, retry, context, pagination, masking

Project description

teamver-sdk-core

Shared async HTTP core for Teamver Python SDKs: transport, unified errors, retry, request context, pagination, and secret masking.

Used by teamver-mail-agent, teamver-agent-sdk, and other Teamver packages.

Install

pip install teamver-sdk-core

Python ≥ 3.11.

Quick start

import asyncio
from teamver_sdk_core import (
    TeamverAsyncTransport,
    TransportConfig,
    RequestContext,
    TeamverSDKError,
)

async def main():
    config = TransportConfig(base_url="https://api.teamver.com", token="tv_ak_…")
    async with TeamverAsyncTransport(config) as transport:
        ctx = RequestContext(workspace_id="WS-…")
        try:
            resp = await transport.request("GET", "/api/v2/collab/channels", context=ctx)
            print(resp.json)
        except TeamverSDKError as exc:
            print(exc.code, exc.status_code, exc.request_id)

asyncio.run(main())

Features

Module Role
transport TeamverAsyncTransport — httpx async requests, retry, error normalization
errors TeamverSDKError tree + error_for_status / parse_error_body
retry RetryPolicy — safe retries (non-idempotent POST needs idempotency_key)
context RequestContextrequest_id / correlation_id
pagination cursor iterate_pages
masking mask tokens / Bearer / internal keys in logs

Error tree

TeamverSDKError
├─ ConfigurationError
├─ AuthenticationError        (401)
├─ AuthorizationError         (403)
├─ NotFoundError              (404)
├─ ConflictError              (409)
│  ├─ IdempotencyConflictError
│  └─ VersionConflictError
├─ RateLimitError             (429)
├─ TemporaryUnavailableError  (502/503/504)
└─ TransportError

Retry rules

  • Retried: transport failure, 429, 502, 503, 504
  • GET/HEAD/PUT/DELETE — treated as idempotent
  • POST/PATCH — retried only when idempotency_key is set

Development

pip install -e ".[dev]"
pytest

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

teamver_sdk_core-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

teamver_sdk_core-0.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file teamver_sdk_core-0.1.0.tar.gz.

File metadata

  • Download URL: teamver_sdk_core-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.9

File hashes

Hashes for teamver_sdk_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3212554b732dfbff0c61d8abae89c6d6d44e2f3ebae9192c5c6422420da0d02e
MD5 df673da50cfb9c7214da03bb15474373
BLAKE2b-256 c9a8c20916ac769ea62537245601f25e2435882627ba435913dc464233e9da22

See more details on using hashes here.

File details

Details for the file teamver_sdk_core-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for teamver_sdk_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34972a2ee890b37a7bc6e465e0dcb8502518fd5e170e2b448e758c0879708a59
MD5 8b3b76916a6d8089042addcd80ceda0f
BLAKE2b-256 27059c314d78145395f5233ecc05d2fc5d283446de7b9773e3d4941d8a111cbc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page