🐍
Python SDK
Official Python library for the RocketVerifier API. Supports Python 3.8+ with full type hints and both sync and async clients.
Installation
pip
pip install rocketverifierQuick Start
Python
from rocketverifier import RocketVerifier
# Initialize with your API key
rv = RocketVerifier('rv_live_xxxxxxxx')
# Verify a single email
result = rv.verify('user@example.com')
print(result.status) # 'deliverable'
print(result.score) # 95
print(result.provider) # 'google.com'Single Verification
result = rv.verify('user@example.com')
# Check if email is valid
if result.is_deliverable:
print('Email is valid!')
# Access all result fields
print(result.email) # 'user@example.com'
print(result.status) # 'deliverable'
print(result.reason) # 'accepted_email'
print(result.score) # 95
# Domain info
print(result.domain.name) # 'example.com'
print(result.domain.accept_all) # False (catch-all)
print(result.domain.disposable) # False
print(result.domain.free) # FalseBatch Verification
# Create a batch job
job = rv.batch.create(
emails=['user1@example.com', 'user2@example.com', ...],
name='My Email List',
webhook_url='https://yoursite.com/webhook' # Optional
)
print(job.id) # 'job_abc123'
# Wait for completion with progress updates
def progress_callback(job):
print(f'Progress: {job.progress:.1f}%')
completed = rv.batch.wait(job.id, on_progress=progress_callback)
# Download results
results = rv.batch.download(job.id)
for result in results:
print(f'{result.email}: {result.status}')Error Handling
from rocketverifier import (
RocketVerifier,
AuthenticationError,
InsufficientCreditsError,
RateLimitError,
)
try:
result = rv.verify('user@example.com')
except AuthenticationError:
print('Invalid API key')
except InsufficientCreditsError as e:
print(f'Need more credits: {e.credits_required}')
except RateLimitError as e:
print(f'Rate limited. Retry after: {e.retry_after} seconds')Context Manager
# Automatically closes the HTTP session
with RocketVerifier('rv_live_xxx') as rv:
result = rv.verify('user@example.com')
print(result.status)Features
Full type hints
Context manager support
Automatic retries
Rate limit handling
Async support (optional)
Python 3.8+
