Commit 534d000
authored
feat: add Amazon SES backend with SigV4 byte-stable signing (#22)
## Summary
Adds a native Amazon SES backend (API v2) to `litestar-email`, alongside a small refactor that splits the backend/transport `__init__.py` files into pure re-export façades.
- New `SESBackend` + `SESConfig` (`region`, `aws_access_key_id`, `aws_secret_access_key`, `aws_session_token`, `timeout`, `http_transport`).
- `botocore` is an *optional* dep — install via `pip install litestar-email[ses]`. No core deps added.
- AWS Signature Version 4 signing via `botocore.auth.SigV4Auth`. **Body bytes are pre-serialized once and used verbatim for both signing and transmission**, so `httpx`'s compact-separator JSON re-serialization can't invalidate `x-amz-content-sha256`.
- `HTTPTransport.post` gained an additive `content: bytes | None` parameter (httpx + aiohttp impls plumbed through). Backward-compatible.
- Maps SES error codes to typed exceptions: 429 → `EmailRateLimitError(retry_after)`, 403 → `EmailAuthenticationError`, other 4xx → `EmailDeliveryError`.
- Attachments (which require SES `Raw` content) and empty-body messages are rejected loudly rather than silently dropped.
- Refactor: `register_backend` → `email_backend` (clearer for custom backend authors). Backend factory moved to `backends/factory.py`, transport factory to `transports/factory.py`. `__init__.py` files are now pure re-exports — RUF067 satisfied without suppression. `SESBackend`/`SESConfig` lifted to top-level `litestar_email` re-exports.
- Docs updated: `docs/usage/backends.rst`, `docs/usage/quickstart.rst`, `docs/reference/api.rst`, `README.md`.1 parent ff41233 commit 534d000
38 files changed
Lines changed: 2556 additions & 4105 deletions
File tree
- .claude
- agents
- commands
- skills/litestar
- docs
- reference
- usage
- src
- litestar_email
- backends
- transports
- utils
- tests
- tools
This file was deleted.
This file was deleted.
0 commit comments