JoshData / JoshData/python-email-validator
Proposal: Add an async email validation function using dnspython’s async resolver
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 1.4k
- Forks
- 140
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Überprüfung von validate_email, ValidatedEmail, EmailNotValidError, den vorhandenen Pydantic-Modellen und dem vorgeschlagenen dns.asyncresolver-Ablauf. Die Arbeit ist abgeschlossen, wenn das Projekt über einen erstklassigen asynchronen Zustellbarkeitsvalidator verfügt, der mit diesen Modellen kompatibel ist, einschließlich der geplanten Tests und Dokumentation.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- backend, networking
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100