JoshData / JoshData/python-email-validator
Proposal: Add an async email validation function using dnspython’s async resolver
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 1.4k
- Forks
- 140
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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?
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par examiner validate_email, ValidatedEmail, EmailNotValidError, les modèles Pydantic existants et le flux dns.asyncresolver proposé. Le travail sera terminé lorsque le projet disposera d’un validateur asynchrone de délivrabilité de première classe compatible avec ces modèles, ainsi que des tests et de la documentation prévus.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- backend, networking
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 30/100