Python
Python Integration Overview
Overview of Python integration options for the Email API
Python Integration Options
Our Email API offers multiple approaches for Python integration:
- Direct REST API calls (no dependencies)
- API Client (using our Python library)
- SMTP Client (using our Python library)
- Web Framework Integration (Flask/Django)
Installation
Comparison of Approaches
1. Direct REST API
View Direct API Implementation →
Pros
- No dependencies required (except
requests
) - Complete control over requests
- Lightweight implementation
- Maximum flexibility
- Simple integration
- Suitable for minimal projects
Example
2. API Client
View API Client Implementation →
Pros
- Type-safe email options
- Built-in error handling
- Automatic request validation
- Simple file attachment handling
- Clean, object-oriented interface
- Regular updates and improvements
Example
3. SMTP Client
View SMTP Client Implementation →
Pros
- SMTP protocol support
- Legacy system compatibility
- Same features as API client
- Multiple recipient support
- Custom headers support
- Attachment handling
Example
4. Web Framework Integration
Flask Integration
Django Integration
Feature Comparison
Feature | Direct API | API Client | SMTP Client | Web Framework |
---|---|---|---|---|
Dependencies | Minimal | Library | Library | Framework |
Type Safety | ❌ | ✅ | ✅ | ✅ |
Error Handling | Manual | Built-in | Built-in | Built-in |
Request Validation | Manual | Auto | Auto | Auto |
File Attachments | Manual | Simple | Simple | Simple |
Multiple Recipients | Manual | ✅ | ✅ | ✅ |
Custom Headers | ✅ | ✅ | ✅ | ✅ |
Queue Support | Manual | Manual | Manual | Framework |
Rate Limiting | Manual | Manual | Manual | Framework |
Framework Features | ❌ | ❌ | ❌ | ✅ |
Learning Curve | Low | Low | Low | Medium |
Setup Complexity | Minimal | Simple | Simple | Moderate |
Choosing the Right Approach
Use Direct API When:
- You want minimal dependencies
- You need complete control
- You’re building a minimal application
- You prefer working directly with the API
- You want the lightest implementation
Use API Client When:
- You want a clean, object-oriented API
- You need type safety
- You want automatic error handling
- You’re using pip/PyPI
- You’re not using a web framework
Use SMTP Client When:
- You need SMTP protocol support
- You’re integrating with legacy systems
- You want the same features as API client
- You need multiple recipient support
- You prefer SMTP over REST
Use Web Framework Integration When:
- You’re using Flask or Django
- You want framework integration
- You need queue support
- You want built-in rate limiting
- You prefer dependency injection
Getting Started
Choose your preferred approach and follow the detailed implementation guide:
- Direct API Implementation Guide →
- API Client Implementation Guide →
- SMTP Client Implementation Guide →
- Flask Integration Guide →
- Django Integration Guide →
All approaches are fully supported and maintained. Choose based on your project’s specific needs and constraints.