官方库

Python 电子邮件验证 SDK

EmailVerify.io 官方 Python SDK。利用原生异步支持和全面的域名基础架构分析工具,构建健壮、抗故障的应用程序。

提供免费计划。无需信用卡。

sdk-example.worker

快速安装

使用 pip 安装官方 EmailVerify Python SDK。

terminal
$ pip install emailverifysdk

使用示例

1 实时电子邮件验证

执行即时 SMTP 握手验证。我们的 Python 库直接连接到我们的高速全球网络,在不发送实际电子邮件的情况下验证邮箱是否存在。

python
from emailverifysdk import Client

client = Client("your_api_key")
result = client.verify("[email protected]")

if result.is_valid:
    print(f"Email is safe to send! Score: {result.score}")
else:
    print(f"Danger: {result.reason}")

2 高吞吐量批量处理

高效处理数百万封电子邮件。批量端点允许您将繁重的验证任务卸载到我们的云端工作节点。使用轮询或 Webhook 异步检索结果。

python
emails =["[email protected]", "[email protected]", ...]
batch_id = client.create_batch(emails)

# Later or poll
status = client.get_batch_status(batch_id)
if status.completed:
    results = client.get_batch_results(batch_id)
    print(f"Processed {len(results)} emails successfully.")

3 高级客户端配置

针对任务关键型应用微调库。设置自定义超时、自动重试逻辑和 SSL 验证设置,以匹配您的企业安全要求。

python
client = Client(
    api_key="your_api_key",
    timeout=30.0,       # Custom second timeout
    max_retries=3,      # Automatic retry on network glitch
    verify_ssl=True     # Ensure secure connections
)

4 智能电子邮件查找器

以高置信度生成经验证的潜在客户。我们的查找器 API 使用先进的启发式算法和历史数据,根据姓名和域名预测并验证专业的电子邮件地址。

python
profile = client.find_email(
    first_name="Jane",
    last_name="Smith",
    domain="acme-corp.com"
)

if profile.email:
    print(f"Found verified email: {profile.email}")
    print(f"Confidence: {profile.confidence}%")

5 语法和域名健康检查

从源头阻止不良数据。验证 RFC 合规性并提供实时拼写错误修正(如将 gmial.com 修正为 gmail.com),以提升注册表单的用户体验。

python
check = client.check_syntax("malformed@@email.com")
print(f"Syntax Valid: {check.is_syntax_valid}")
print(f"Correction Suggestion: {check.suggestion}") # e.g. @gmial.com -> @gmail.com

6 健壮的错误处理

构建具有弹性的应用程序。我们的库为速率限制、身份验证失败和网络超时提供了特定的异常类,允许您实现优雅降级。

python
try:
    result = client.verify("[email protected]")
except client.RateLimitError:
    print("Backing off... Please upgrade your plan.")
except client.AuthenticationError:
    print("Check your API key.")
except Exception as e:
    print(f"Network error: {e}")

7 异步支持 (Asyncio)

专为现代 Web 框架优化。切换到我们的 AsyncClient 以配合 FastAPI、Sanic 或 Django Channels 使用,在不阻塞事件循环的情况下管理高并发验证任务。

python
import asyncio
from emailverifysdk.async_client import AsyncClient

async def main():
    async with AsyncClient("api_key") as client:
        result = await client.verify("[email protected]")
        print(result.status)

asyncio.run(main())

8 MX 和基础架构分析

深入研究收件人的基础架构。检测域名是否使用一次性邮件提供商、全接收 (Catch-all) 配置,或 Google Workspace、Microsoft 365 等专业 ESP。

python
info = client.get_domain_info("google.com")
print(f"Provider: {info.provider}") # e.g. Google Workspace
print(f"Accepts All: {info.is_catch_all}")
print(f"Is Disposable: {info.is_disposable}")
常见问题

常见问题解答

Question Icon

使用 Python SDK 需要 API 密钥吗?

是的,您需要来自 EmailVerify.io 控制面板的有效 API 密钥。您可以注册免费账户立即获取密钥。

Question Icon

Python SDK 的结果有多准确?

通过实时 SMTP 握手检查和先进的一次性电子邮件检测,我们的 Python SDK 提供 99% 以上的准确率。

Question Icon

我可以在异步应用程序中使用 Python SDK 吗?

是的,该 SDK 非常轻量,可以轻松地在 FastAPI 等异步框架或 asyncio 等库中使用。

Question Icon

Python SDK 是否支持批量验证?

是的,它包含一个 validate_batch 方法,用于在后台高效处理大量电子邮件列表。

你只需点击一下即可获得干净的邮箱列表。

立即开始验证你的邮箱地址,提升营销活动的送达率

* 无需信用卡