dwy-email-notify
邮件平台官方 Webhook 事件接入与通知转发。当前提供 Resend,未来平台各自添加 provider 和 extra;本包不提供业务发信、验证码或邮件正文读取功能。
pip install 'dwy-email-notify[resend]==0.1.0'
from fastapi import FastAPI
from dwy_notify import NotificationConfig
from dwy_email_notify import EmailNotifyConfig, ResendWebhookConfig, install_email_notifications
def configure(app: FastAPI, signing_secret: str, notification_url: str) -> None:
install_email_notifications(app, EmailNotifyConfig(
notifications=NotificationConfig(targets={"operations": notification_url}),
resend=ResendWebhookConfig(secret=signing_secret),
))
配置由宿主从安全配置中显式注入,本包不读取环境或 dotenv。Resend 只需要独立的 Webhook signing secret,无需发信 API key。默认接收路径为 /webhooks/resend,可由配置覆盖;只有配置来源后才加载对应 SDK。
事件经过原始载荷大小限制、官方 SDK 验签及事件筛选后才交付。仅转发事件类型、邮件编号和通知编号,不读取或转发主题、正文、收件人。默认转发使用“邮件通知”名称及固定 GitHub PNG 头像,应用可以通过 NotificationConfig.appearance 覆盖名称或显式清除头像。最终发送者名称必填;本包提供默认名称。
默认内存去重只覆盖当前进程,只有成功发送才登记。需要重启后仍可靠接收的宿主,应通过 sink 注入自己的持久化接收函数;返回 True 表示新事件被接受,False 表示已接受的重复事件,失败必须抛出异常,不能提前向 Resend 确认成功。
安装器返回 EmailNotifyRuntime,只持有去重状态,不接管宿主数据库、异常处理器或 lifespan。同一 FastAPI 应用只安装一次。providers.resend.webhooks.create_resend_router 可用于自行组合路由。
通知头像保持已有固定公开资产引用,不打包图片或拉取浮动分支:https://raw.githubusercontent.com/danweiyuancircle/dwy-ai-experience/091ad4fea18ed3840fec83dc833f18b759256ca7/backend/packages/webhooks/assets/email.png。
Metadata
Release files for dwy-email-notify 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dwy_email_notify-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dwy_email_notify-0.1.0-py3-none-any.whl |
Release files / dwy_email_notify-0.1.0-py3-none-any.whl
| Download URL | dwy_email_notify-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca85166e8c504f1f27adaf9947255bd77ecc30fee8798b3c5903cd9a6d9e3972
|
|
BLAKE2b-256 checksum How to use checksums |
70ca753ebdb8cd41145bb496f020532f6db872c0bba2e6939b73f583bb018c32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for dwy-email-notify 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
1 file in this release has been uploaded with provenance metadata.
Attestation for dwy_email_notify-0.1.0-py3-none-any.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.