JoshData / JoshData/python-email-validator

Proposal: Add an async email validation function using dnspython’s async resolver

オープン
#164 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず validate_email、ValidatedEmail、EmailNotValidError、既存の Pydantic モデル、および提案されている dns.asyncresolver のフローを確認してください。計画されているテストとドキュメントを含め、これらのモデルと互換性のある第一級の非同期配信可能性バリデーターがプロジェクトに備わった時点で、作業は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
backend, networking
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。