Skip to content

Official Python SDK (senddock on PyPI) #102

Done
SendDock/senddock-python
#1

Description

@JuansesDev

Problem

@senddock/sdk covers TypeScript and JavaScript. Python is the other language SendDock users reach for from their backends, crons and data pipelines, and today they are back to hand-written requests calls with no types, no retry handling and no webhook verification.

Proposal

An official Python SDK, published to PyPI as senddock, mirroring the TypeScript SDK one-to-one so the docs stay symmetric:

  • SendDock(base_url=..., project_id=..., api_key=...) with send, send_batch, broadcast, import_subscribers, stats, and a verify_webhook_signature helper.
  • Typed request and response models (dataclasses or TypedDicts, py.typed), a single SendDockError carrying the API message and status, Retry-After-aware retries on 429/5xx, configurable timeout, and a sync client first with an async variant on the roadmap.
  • No runtime dependencies beyond the standard library (urllib) — or httpx as a single optional extra for the async client.
  • Python 3.9+, tests covering the same matrix as senddock-js (auth header, each endpoint, suppressed passthrough, error mapping, retry exhaustion, webhook signature edge cases), published with PyPI trusted publishing from GitHub Actions.
  • Lives in its own repository (senddock-python) with its own CI, README quickstart and a docs page under /api/sdk-python.

Acceptance

  • Repository with the client, models, error type, webhook helper and tests
  • senddock published on PyPI via trusted publishing, with py.typed
  • Docs page mirroring the TypeScript SDK page, linked from the API sidebar and the code-examples page
  • README of Core lists it next to the TypeScript SDK

Activity

  1. added this to the 0.9 milestone on Aug 21, 2026
  2. added
    enhancement
    on Aug 21, 2026
  3. khoap1220-hue commented on Nov 26, 2026

    @khoap1220-hue

    I put together a clean-room MIT Python 3.9+ SDK proof-of-concept mirroring @senddock/sdk v0.2.0 and the Go webhook/API handlers one-to-one: https://github.com/khoap1220-hue/senddock-python

    • Zero required runtime dependencies (stdlib urllib.request) with py.typed models, plus an optional AsyncSendDock extra backed by httpx (pip install "senddock[async]").
    • Covers all five project-scoped endpoints under /api/v1/projects/{project_id}: send (email, subscriber, and raw HTML unions with HTTP 200 suppression passthrough), send_batch, broadcast (segment_id / newsletter_id), import_subscribers (bare JSON array + lowercase validate_mx / validate_disposable query flags), and stats.
    • Single SendDockError carrying status, code, message, body, and convenience flags, with exponential backoff on 429/500/502/503/504 and Retry-After capped at 60s.
    • Constant-time verify_webhook_signature (X-SendDock-Signature: t=<unix>,v1=<hmac>, 300s replay window, hmac.compare_digest), 35 offline unit + loopback HTTP tests, and GitHub Actions CI + PyPI Trusted Publishing workflows.

    If this matches the surface you want for 0.9, I'm glad to transfer senddock-python into the SendDock org and open a companion PR adding /api/sdk-python to the docs.

  4. JuansesDev commented on Nov 26, 2026

    @JuansesDev
    MemberAuthor
  5. khoap1220-hue commented on Nov 27, 2026

    @khoap1220-hue

    Opened SendDock/senddock-python#1 with all three updates applied (README.md cleaned to official docs only, pyproject.toml URLs pointed to SendDock/senddock-python, and AsyncSendDock._request narrowed via _async_network_exception_types() with regression tests ensuring non-network exceptions propagate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dxenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions