emailintel 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- emailintel-0.1.0/.gitignore +7 -0
- emailintel-0.1.0/PKG-INFO +188 -0
- emailintel-0.1.0/README.md +160 -0
- emailintel-0.1.0/emailintel/__init__.py +64 -0
- emailintel-0.1.0/emailintel/client.py +601 -0
- emailintel-0.1.0/emailintel/errors.py +133 -0
- emailintel-0.1.0/emailintel/models.py +412 -0
- emailintel-0.1.0/emailintel/retry.py +129 -0
- emailintel-0.1.0/pyproject.toml +42 -0
- emailintel-0.1.0/tests/conftest.py +42 -0
- emailintel-0.1.0/tests/test_client.py +406 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: emailintel
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for the Email Deliverability Intelligence API
|
|
5
|
+
Project-URL: Homepage, https://emailintel.dev
|
|
6
|
+
Project-URL: Documentation, https://docs.emailintel.dev
|
|
7
|
+
Project-URL: Repository, https://github.com/email-deliverability-intelligence/python-sdk
|
|
8
|
+
Author-email: Jonathon Tamm <j.tamm@dynamics-group.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: catch-all,deliverability,domain-intelligence,email,verification
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Requires-Dist: httpx>=0.25.0
|
|
22
|
+
Requires-Dist: pydantic>=2.0.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: respx>=0.21.0; extra == 'dev'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Email Deliverability Intelligence - Python SDK
|
|
30
|
+
|
|
31
|
+
Official Python SDK for the [Email Deliverability Intelligence API](https://emailintel.dev). Verify emails, analyze domain health, predict deliverability, and more -- all without sending test emails.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install emailintel
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
### Synchronous
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from emailintel import EmailIntelClient
|
|
45
|
+
|
|
46
|
+
client = EmailIntelClient(api_key="edi_live_your_key_here")
|
|
47
|
+
|
|
48
|
+
# Verify an email
|
|
49
|
+
result = client.verify_email("john@example.com", deep_scan=True)
|
|
50
|
+
print(f"Result: {result.result}, Confidence: {result.confidence}")
|
|
51
|
+
|
|
52
|
+
# Get domain intelligence
|
|
53
|
+
intel = client.get_domain_intelligence("example.com")
|
|
54
|
+
print(f"Provider: {intel.provider}, Risk: {intel.risk_level}")
|
|
55
|
+
|
|
56
|
+
# Find someone's email
|
|
57
|
+
found = client.find_email("example.com", "John", "Doe")
|
|
58
|
+
print(f"Email: {found.email}, Confidence: {found.confidence}")
|
|
59
|
+
|
|
60
|
+
client.close()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Asynchronous
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import asyncio
|
|
67
|
+
from emailintel import AsyncEmailIntelClient
|
|
68
|
+
|
|
69
|
+
async def main():
|
|
70
|
+
async with AsyncEmailIntelClient(api_key="edi_live_your_key_here") as client:
|
|
71
|
+
result = await client.verify_email("john@example.com")
|
|
72
|
+
print(f"Result: {result.result}, Confidence: {result.confidence}")
|
|
73
|
+
|
|
74
|
+
asyncio.run(main())
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Context Manager
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from emailintel import EmailIntelClient
|
|
81
|
+
|
|
82
|
+
with EmailIntelClient(api_key="edi_live_your_key_here") as client:
|
|
83
|
+
result = client.verify_email("john@example.com")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Available Methods
|
|
87
|
+
|
|
88
|
+
### Email Verification
|
|
89
|
+
|
|
90
|
+
- `verify_email(email, deep_scan=False, include_signals=False)` -- Verify a single email
|
|
91
|
+
- `verify_batch(emails, webhook_url=None)` -- Submit batch verification
|
|
92
|
+
- `get_batch_status(job_id)` -- Check batch job status
|
|
93
|
+
|
|
94
|
+
### Domain Intelligence
|
|
95
|
+
|
|
96
|
+
- `get_domain_intelligence(domain)` -- Full domain intelligence
|
|
97
|
+
- `get_domain_pattern(domain)` -- Email naming pattern detection
|
|
98
|
+
- `get_domain_compliance(domain)` -- Bulk sender compliance check
|
|
99
|
+
- `get_domain_blacklist(domain, refresh=False)` -- DNSBL blacklist check
|
|
100
|
+
- `get_domain_report(domain, format="json")` -- Comprehensive domain report
|
|
101
|
+
- `compare_domains(domains)` -- Compare 2-5 domains side-by-side
|
|
102
|
+
- `get_domain_reputation(domain)` -- Sender reputation score (0-100)
|
|
103
|
+
- `get_reputation_history(domain, limit=30)` -- Reputation score timeline
|
|
104
|
+
- `get_domain_advisor(domain)` -- AI infrastructure recommendations
|
|
105
|
+
|
|
106
|
+
### Email Finder
|
|
107
|
+
|
|
108
|
+
- `find_email(domain, first_name, last_name)` -- Predict email address
|
|
109
|
+
|
|
110
|
+
### Content Analysis
|
|
111
|
+
|
|
112
|
+
- `analyze_content(subject, body, sender_domain)` -- Spam risk analysis
|
|
113
|
+
|
|
114
|
+
### Predictions
|
|
115
|
+
|
|
116
|
+
- `predict_engagement(email, content_snippet=None)` -- Engagement likelihood
|
|
117
|
+
- `predict_deliverability(sender_domain, recipient_email)` -- Inbox placement prediction
|
|
118
|
+
|
|
119
|
+
### Domain Monitoring
|
|
120
|
+
|
|
121
|
+
- `register_monitored_domains(domains, webhook_url, interval_seconds=21600)` -- Register monitoring
|
|
122
|
+
- `list_monitored_domains()` -- List monitored domains
|
|
123
|
+
- `unregister_monitored_domain(domain)` -- Remove monitoring
|
|
124
|
+
|
|
125
|
+
### Postmaster Tools
|
|
126
|
+
|
|
127
|
+
- `get_postmaster_data(domain)` -- Combined Google + Microsoft data
|
|
128
|
+
- `sync_postmaster_data(domain)` -- Trigger manual data sync
|
|
129
|
+
|
|
130
|
+
## Error Handling
|
|
131
|
+
|
|
132
|
+
The SDK throws typed exceptions for different error conditions:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from emailintel import (
|
|
136
|
+
EmailIntelClient,
|
|
137
|
+
AuthenticationError,
|
|
138
|
+
RateLimitError,
|
|
139
|
+
InsufficientCreditsError,
|
|
140
|
+
ValidationError,
|
|
141
|
+
NotFoundError,
|
|
142
|
+
ServerError,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
client = EmailIntelClient(api_key="edi_live_your_key_here")
|
|
146
|
+
|
|
147
|
+
try:
|
|
148
|
+
result = client.verify_email("john@example.com")
|
|
149
|
+
except AuthenticationError:
|
|
150
|
+
print("Invalid API key")
|
|
151
|
+
except RateLimitError as e:
|
|
152
|
+
print(f"Rate limited. Retry after {e.retry_after}s")
|
|
153
|
+
except InsufficientCreditsError:
|
|
154
|
+
print("No credits remaining")
|
|
155
|
+
except ValidationError as e:
|
|
156
|
+
print(f"Bad request: {e.details}")
|
|
157
|
+
except ServerError:
|
|
158
|
+
print("Server error - will auto-retry")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Configuration
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
client = EmailIntelClient(
|
|
165
|
+
api_key="edi_live_your_key_here",
|
|
166
|
+
base_url="https://api.emailintel.dev", # Custom base URL
|
|
167
|
+
max_retries=3, # Retry transient failures
|
|
168
|
+
timeout=30.0, # Request timeout in seconds
|
|
169
|
+
)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Auto-Retry
|
|
173
|
+
|
|
174
|
+
The SDK automatically retries on transient failures:
|
|
175
|
+
|
|
176
|
+
- **429 (Rate Limited)**: Respects `retry_after` from the response
|
|
177
|
+
- **5xx (Server Errors)**: Exponential backoff with jitter
|
|
178
|
+
- **400, 401, 402, 404**: Never retried (client errors)
|
|
179
|
+
|
|
180
|
+
## Requirements
|
|
181
|
+
|
|
182
|
+
- Python 3.9+
|
|
183
|
+
- httpx >= 0.25.0
|
|
184
|
+
- pydantic >= 2.0.0
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
MIT
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Email Deliverability Intelligence - Python SDK
|
|
2
|
+
|
|
3
|
+
Official Python SDK for the [Email Deliverability Intelligence API](https://emailintel.dev). Verify emails, analyze domain health, predict deliverability, and more -- all without sending test emails.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install emailintel
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Synchronous
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from emailintel import EmailIntelClient
|
|
17
|
+
|
|
18
|
+
client = EmailIntelClient(api_key="edi_live_your_key_here")
|
|
19
|
+
|
|
20
|
+
# Verify an email
|
|
21
|
+
result = client.verify_email("john@example.com", deep_scan=True)
|
|
22
|
+
print(f"Result: {result.result}, Confidence: {result.confidence}")
|
|
23
|
+
|
|
24
|
+
# Get domain intelligence
|
|
25
|
+
intel = client.get_domain_intelligence("example.com")
|
|
26
|
+
print(f"Provider: {intel.provider}, Risk: {intel.risk_level}")
|
|
27
|
+
|
|
28
|
+
# Find someone's email
|
|
29
|
+
found = client.find_email("example.com", "John", "Doe")
|
|
30
|
+
print(f"Email: {found.email}, Confidence: {found.confidence}")
|
|
31
|
+
|
|
32
|
+
client.close()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Asynchronous
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
import asyncio
|
|
39
|
+
from emailintel import AsyncEmailIntelClient
|
|
40
|
+
|
|
41
|
+
async def main():
|
|
42
|
+
async with AsyncEmailIntelClient(api_key="edi_live_your_key_here") as client:
|
|
43
|
+
result = await client.verify_email("john@example.com")
|
|
44
|
+
print(f"Result: {result.result}, Confidence: {result.confidence}")
|
|
45
|
+
|
|
46
|
+
asyncio.run(main())
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Context Manager
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from emailintel import EmailIntelClient
|
|
53
|
+
|
|
54
|
+
with EmailIntelClient(api_key="edi_live_your_key_here") as client:
|
|
55
|
+
result = client.verify_email("john@example.com")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Available Methods
|
|
59
|
+
|
|
60
|
+
### Email Verification
|
|
61
|
+
|
|
62
|
+
- `verify_email(email, deep_scan=False, include_signals=False)` -- Verify a single email
|
|
63
|
+
- `verify_batch(emails, webhook_url=None)` -- Submit batch verification
|
|
64
|
+
- `get_batch_status(job_id)` -- Check batch job status
|
|
65
|
+
|
|
66
|
+
### Domain Intelligence
|
|
67
|
+
|
|
68
|
+
- `get_domain_intelligence(domain)` -- Full domain intelligence
|
|
69
|
+
- `get_domain_pattern(domain)` -- Email naming pattern detection
|
|
70
|
+
- `get_domain_compliance(domain)` -- Bulk sender compliance check
|
|
71
|
+
- `get_domain_blacklist(domain, refresh=False)` -- DNSBL blacklist check
|
|
72
|
+
- `get_domain_report(domain, format="json")` -- Comprehensive domain report
|
|
73
|
+
- `compare_domains(domains)` -- Compare 2-5 domains side-by-side
|
|
74
|
+
- `get_domain_reputation(domain)` -- Sender reputation score (0-100)
|
|
75
|
+
- `get_reputation_history(domain, limit=30)` -- Reputation score timeline
|
|
76
|
+
- `get_domain_advisor(domain)` -- AI infrastructure recommendations
|
|
77
|
+
|
|
78
|
+
### Email Finder
|
|
79
|
+
|
|
80
|
+
- `find_email(domain, first_name, last_name)` -- Predict email address
|
|
81
|
+
|
|
82
|
+
### Content Analysis
|
|
83
|
+
|
|
84
|
+
- `analyze_content(subject, body, sender_domain)` -- Spam risk analysis
|
|
85
|
+
|
|
86
|
+
### Predictions
|
|
87
|
+
|
|
88
|
+
- `predict_engagement(email, content_snippet=None)` -- Engagement likelihood
|
|
89
|
+
- `predict_deliverability(sender_domain, recipient_email)` -- Inbox placement prediction
|
|
90
|
+
|
|
91
|
+
### Domain Monitoring
|
|
92
|
+
|
|
93
|
+
- `register_monitored_domains(domains, webhook_url, interval_seconds=21600)` -- Register monitoring
|
|
94
|
+
- `list_monitored_domains()` -- List monitored domains
|
|
95
|
+
- `unregister_monitored_domain(domain)` -- Remove monitoring
|
|
96
|
+
|
|
97
|
+
### Postmaster Tools
|
|
98
|
+
|
|
99
|
+
- `get_postmaster_data(domain)` -- Combined Google + Microsoft data
|
|
100
|
+
- `sync_postmaster_data(domain)` -- Trigger manual data sync
|
|
101
|
+
|
|
102
|
+
## Error Handling
|
|
103
|
+
|
|
104
|
+
The SDK throws typed exceptions for different error conditions:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from emailintel import (
|
|
108
|
+
EmailIntelClient,
|
|
109
|
+
AuthenticationError,
|
|
110
|
+
RateLimitError,
|
|
111
|
+
InsufficientCreditsError,
|
|
112
|
+
ValidationError,
|
|
113
|
+
NotFoundError,
|
|
114
|
+
ServerError,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
client = EmailIntelClient(api_key="edi_live_your_key_here")
|
|
118
|
+
|
|
119
|
+
try:
|
|
120
|
+
result = client.verify_email("john@example.com")
|
|
121
|
+
except AuthenticationError:
|
|
122
|
+
print("Invalid API key")
|
|
123
|
+
except RateLimitError as e:
|
|
124
|
+
print(f"Rate limited. Retry after {e.retry_after}s")
|
|
125
|
+
except InsufficientCreditsError:
|
|
126
|
+
print("No credits remaining")
|
|
127
|
+
except ValidationError as e:
|
|
128
|
+
print(f"Bad request: {e.details}")
|
|
129
|
+
except ServerError:
|
|
130
|
+
print("Server error - will auto-retry")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Configuration
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
client = EmailIntelClient(
|
|
137
|
+
api_key="edi_live_your_key_here",
|
|
138
|
+
base_url="https://api.emailintel.dev", # Custom base URL
|
|
139
|
+
max_retries=3, # Retry transient failures
|
|
140
|
+
timeout=30.0, # Request timeout in seconds
|
|
141
|
+
)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Auto-Retry
|
|
145
|
+
|
|
146
|
+
The SDK automatically retries on transient failures:
|
|
147
|
+
|
|
148
|
+
- **429 (Rate Limited)**: Respects `retry_after` from the response
|
|
149
|
+
- **5xx (Server Errors)**: Exponential backoff with jitter
|
|
150
|
+
- **400, 401, 402, 404**: Never retried (client errors)
|
|
151
|
+
|
|
152
|
+
## Requirements
|
|
153
|
+
|
|
154
|
+
- Python 3.9+
|
|
155
|
+
- httpx >= 0.25.0
|
|
156
|
+
- pydantic >= 2.0.0
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Email Deliverability Intelligence SDK for Python.
|
|
3
|
+
Official client library for the Email Deliverability Intelligence API.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
__version__ = "0.1.0"
|
|
7
|
+
|
|
8
|
+
from .client import AsyncEmailIntelClient, EmailIntelClient
|
|
9
|
+
from .errors import (
|
|
10
|
+
AuthenticationError,
|
|
11
|
+
EmailIntelError,
|
|
12
|
+
InsufficientCreditsError,
|
|
13
|
+
NotFoundError,
|
|
14
|
+
RateLimitError,
|
|
15
|
+
ServerError,
|
|
16
|
+
ValidationError,
|
|
17
|
+
)
|
|
18
|
+
from .models import (
|
|
19
|
+
AdvisorReport,
|
|
20
|
+
BatchJobStatus,
|
|
21
|
+
ContentAnalysis,
|
|
22
|
+
DeliverabilityPrediction,
|
|
23
|
+
DomainComparison,
|
|
24
|
+
DomainIntelligence,
|
|
25
|
+
DomainReport,
|
|
26
|
+
EmailFinderResult,
|
|
27
|
+
EngagementPrediction,
|
|
28
|
+
MonitoredDomainsList,
|
|
29
|
+
MonitorRegistration,
|
|
30
|
+
PostmasterData,
|
|
31
|
+
ReputationHistory,
|
|
32
|
+
ReputationScore,
|
|
33
|
+
VerificationResult,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
__all__ = [
|
|
37
|
+
# Clients
|
|
38
|
+
"EmailIntelClient",
|
|
39
|
+
"AsyncEmailIntelClient",
|
|
40
|
+
# Errors
|
|
41
|
+
"EmailIntelError",
|
|
42
|
+
"AuthenticationError",
|
|
43
|
+
"InsufficientCreditsError",
|
|
44
|
+
"RateLimitError",
|
|
45
|
+
"ValidationError",
|
|
46
|
+
"NotFoundError",
|
|
47
|
+
"ServerError",
|
|
48
|
+
# Models
|
|
49
|
+
"VerificationResult",
|
|
50
|
+
"BatchJobStatus",
|
|
51
|
+
"DomainIntelligence",
|
|
52
|
+
"DomainReport",
|
|
53
|
+
"DomainComparison",
|
|
54
|
+
"ReputationScore",
|
|
55
|
+
"ReputationHistory",
|
|
56
|
+
"AdvisorReport",
|
|
57
|
+
"DeliverabilityPrediction",
|
|
58
|
+
"EngagementPrediction",
|
|
59
|
+
"ContentAnalysis",
|
|
60
|
+
"PostmasterData",
|
|
61
|
+
"EmailFinderResult",
|
|
62
|
+
"MonitorRegistration",
|
|
63
|
+
"MonitoredDomainsList",
|
|
64
|
+
]
|