Sendrella Python SDK
The official Python SDK for Sendrella — a modern infrastructure for secure and intelligent email communication.
Effortlessly integrate the Sendrella API into your Python apps for:
- ✉️ Email bounce checks
- 🛡️ Disposable (temporary) email detection
- 📊 Credit tracking
- 🔐 API key validation
📦 Installation
🔗 Install via PyPI (recommended):
pip install sendrella
🧪 Development (local or GitHub):
pip install git+https://github.com/Salman0x01/sendrella-python-sdk.git
Or clone and install locally:
git clone https://github.com/Salman0x01/sendrella-python-sdk.git
cd sendrella-python-sdk
pip install .
🚀 Quick Start
from sendrella import SendrellaClient
client = SendrellaClient(api_key="your_api_key_here")
result = client.bounce.check("hello@example.com")
print(result["status"])
🔑 Authentication
Every API call requires a valid Sendrella API key.
🔐 Get your key:
from sendrella import SendrellaClient
client = SendrellaClient(api_key="your_api_key_here")
🧠 Usage Examples
📬 Check Email Bounce
result = client.bounce.check("hello@example.com")
print(result["status"])
print(result["bounce_score"])
print(result["confidence_indicators"])
📑 Retrieve Bounce Logs
logs = client.bounce.logs(page=1, status="risky")
for log in logs["logs"]:
print(log["email"], "-", log["status"], "(", log["bounce_score"], ")")
🛡️ Check Disposable Email
result = client.temp_mail.check("user@mailinator.com")
if result.get("is_disposable"):
print("❌ Disposable email detected")
else:
print("✅ Clean email")
📂 View Temp Mail Logs
logs = client.temp_mail.logs(page=1)
for log in logs["logs"]:
print(log["email"], "-", log["status"], "via", log["detection_method"])
💳 Fetch Credits
credits = client.utils.credits()
print("Available:", credits["available_credits"])
print("Used:", credits["all_time_used"])
print("Total:", credits["all_time_credits"])
🔐 Validate API Key
info = client.utils.validate_key()
if info.get("success"):
print("Authenticated as:", info.get("name"))
else:
print("Invalid or expired API key")
🧪 Running Tests
pytest -v tests/
pytest -v tests/test_bounce.py
Make sure to set your API key:
set SENDRELLA_API_KEY=your_api_key_here
export SENDRELLA_API_KEY=your_api_key_here
📚 Supported Endpoints
Bounce Check | client.bounce.check() | /bounce/check |
Bounce Logs | client.bounce.logs() | /bounce/logs |
Disposable Check | client.temp_mail.check() | /tempmail/check |
Temp Logs | client.temp_mail.logs() | /tempmail/logs |
Get Credits | client.utils.credits() | /utils/credits |
Validate API Key | client.utils.validate_key() | /token/validate |
🛠️ Error Handling
All errors are wrapped in custom exceptions:
SendrellaError
(base)
AuthenticationError
BadRequestError
ServerError
TimeoutError
NotFoundError
Example:
from sendrella.exceptions import AuthenticationError
try:
result = client.bounce.check("email@example.com")
except AuthenticationError:
print("Invalid API key or permission denied.")
📄 License
MIT License © 2025 Salman Khan
❤️ Contributing
PRs welcome! Please submit bug fixes, improvements, or new endpoints with test coverage.
🔗 Useful Links