You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@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
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.
Hey Khoa, thanks for putting this together. I reviewed the repo and the
implementation looks solid — stdlib sync client, optional httpx async,
constant-time webhook verification, and good test coverage.
Rather than juggling org transfer permissions, I went ahead and created
`SendDock/senddock-python` (https://github.com/SendDock/senddock-python) so
you can open an initial PR and keep full Git/Contributor credit. Before
merging, a few small tweaks we'd need:
- Remove the freelance services / Contra promotional section from
`README.md` (contributor credit in Git/changelog is totally fine, just no
promotional links in the official SDK README).
- Point `pyproject.toml` URLs/metadata to `SendDock/senddock-python`.
- Narrow `except Exception` in `AsyncSendDock._request` to `httpx`/network
exceptions so non-network bugs aren't swallowed.
Feel free to open the PR whenever you're ready — I'll review and merge it
once I'm back from a busy week.
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).
Activity
khoap1220-hue commentedon Nov 26, 2026
I put together a clean-room MIT Python 3.9+ SDK proof-of-concept mirroring
@senddock/sdkv0.2.0 and the Go webhook/API handlers one-to-one: https://github.com/khoap1220-hue/senddock-pythonurllib.request) withpy.typedmodels, plus an optionalAsyncSendDockextra backed byhttpx(pip install "senddock[async]")./api/v1/projects/{project_id}:send(email, subscriber, and raw HTML unions with HTTP200suppression passthrough),send_batch,broadcast(segment_id/newsletter_id),import_subscribers(bare JSON array + lowercasevalidate_mx/validate_disposablequery flags), andstats.SendDockErrorcarryingstatus,code,message,body, and convenience flags, with exponential backoff on429/500/502/503/504andRetry-Aftercapped at60s.verify_webhook_signature(X-SendDock-Signature: t=<unix>,v1=<hmac>,300sreplay window,hmac.compare_digest),35offline 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 transfersenddock-pythoninto theSendDockorg and open a companion PR adding/api/sdk-pythonto the docs.JuansesDev commentedon Nov 26, 2026
khoap1220-hue commentedon Nov 27, 2026
Opened SendDock/senddock-python#1 with all three updates applied (
README.mdcleaned to official docs only,pyproject.tomlURLs pointed toSendDock/senddock-python, andAsyncSendDock._requestnarrowed via_async_network_exception_types()with regression tests ensuring non-network exceptions propagate).