JoshData / JoshData/python-email-validator
Proposal: Add an async email validation function using dnspython’s async resolver
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.4k
- 派生
- 140
- PR 合并指标
- 30 天内没有已合并 PR
描述
I maintain a high-volume lead-gen API that validates thousands of emails per request. To keep latency low, we can’t rely on the library’s check_deliverability=True option because it triggers blocking DNS lookups. Instead, we run the library with deliverability checks disabled and perform our own async DNS queries via dns.asyncresolver.
It would be a real improvement if the library exposed a first-class async deliverability path. Below is a minimal prototype showing what that could look like:
from email_validator import validate_email, EmailNotValidError, ValidatedEmail
import dns.asyncresolver
dns_resolver = dns.asyncresolver.Resolver()
async def _resolve_mail_hosts(domain: str):
try: return await dns_resolver.resolve(domain, "MX")
except Exception:
for record_type in ("A", "AAAA"):
try: return await dns_resolver.resolve(domain, record_type)
except Exception: continue
return None
async def aio_validate_email(email: str) -> ValidatedEmail:
email_info = validate_email(email, check_deliverability=False)
if await _resolve_mail_hosts(email_info.domain) is None: raise EmailNotValidError
return email_info
My plan is to open a PR that adds an async validator fully compatible with your existing Pydantic models, plus tests and documentation. Before I invest the time, are you open to adding async support to the project?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先审查 validate_email、ValidatedEmail、EmailNotValidError、现有的 Pydantic 模型以及拟议的 dns.asyncresolver 流程。当项目具备与这些模型兼容的一流异步可送达性验证器,并完成计划中的测试和文档后,这项工作即告完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend, networking
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 30/100