JoshData / JoshData/python-email-validator

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

Đang mở
#164 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
1.4k
Fork
140
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách xem xét validate_email, ValidatedEmail, EmailNotValidError, các model Pydantic hiện có và luồng dns.asyncresolver được đề xuất. Công việc hoàn tất khi dự án có một trình xác thực khả năng gửi email bất đồng bộ hạng nhất tương thích với các model đó, cùng với các bài kiểm thử và tài liệu đã được lên kế hoạch.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
backend, networking
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.