Python FastAPI Email Verification Guide
Add real-time email verification and disposable-email blocking to Python FastAPI with the VeriShield Edge API. The snippet below gates a signup and returns the canonical email identity.
Language
Python 3.12
Ecosystem
ASGI / Pydantic
Latency
< 85ms
Install
Shell
pip install httpx fastapiVerification code
Python 3.12
import os, httpx
from fastapi import HTTPException
async def verify_email_dependency(email: str) -> dict:
async with httpx.AsyncClient(timeout=3.0) as client:
resp = await client.post(
'https://verishield-edge-api.p.rapidapi.com/v1/verify',
headers={'X-RapidAPI-Key': os.getenv('RAPIDAPI_KEY', '')},
json={'email': email}
)
data = resp.json()
if data['fraud_risk']['recommendation'] == 'BLOCK':
raise HTTPException(status_code=403, detail='Blocked disposable/fraud email')
return dataWhat this protects against
Disposable and temporary inboxes, Gmail dot-trick and plus-alias multi-accounting, high-entropy bot usernames, and freshly registered fraud domains. The API returns a 0-100 fraud score with an ALLOW, CHALLENGE_2FA or BLOCK recommendation.