revenuebase-sdk 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.
- revenuebase_sdk-0.1.0/.gitignore +43 -0
- revenuebase_sdk-0.1.0/LICENSE +21 -0
- revenuebase_sdk-0.1.0/PKG-INFO +207 -0
- revenuebase_sdk-0.1.0/README.md +172 -0
- revenuebase_sdk-0.1.0/pyproject.toml +77 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/__init__.py +74 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/_base_client.py +393 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/_client.py +195 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/_constants.py +6 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/_exceptions.py +107 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/_resource.py +20 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/_version.py +1 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/py.typed +0 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/resources/__init__.py +6 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/resources/company_resolver.py +223 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/resources/email_processing.py +338 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/resources/user_operations.py +62 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/__init__.py +13 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/_client.py +220 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/_exceptions.py +19 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/_query.py +183 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/_tables.py +8 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/types/__init__.py +9 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/types/insights.py +23 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/types/organization.py +41 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/types/people.py +37 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/snowflake/types/pre_joined.py +36 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/types/__init__.py +9 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/types/company_resolver.py +45 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/types/email_processing.py +111 -0
- revenuebase_sdk-0.1.0/src/revenuebase_sdk/types/user_operations.py +19 -0
- revenuebase_sdk-0.1.0/tests/conftest.py +15 -0
- revenuebase_sdk-0.1.0/tests/test_company_resolver.py +117 -0
- revenuebase_sdk-0.1.0/tests/test_email_processing.py +160 -0
- revenuebase_sdk-0.1.0/tests/test_snowflake.py +534 -0
- revenuebase_sdk-0.1.0/tests/test_user_operations.py +65 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
*.egg-info/
|
|
7
|
+
*.egg
|
|
8
|
+
.eggs/
|
|
9
|
+
|
|
10
|
+
# Build / dist
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
*.whl
|
|
14
|
+
*.tar.gz
|
|
15
|
+
|
|
16
|
+
# Environments
|
|
17
|
+
.env
|
|
18
|
+
.env.*
|
|
19
|
+
.venv/
|
|
20
|
+
venv/
|
|
21
|
+
env/
|
|
22
|
+
|
|
23
|
+
# Type checking / linting
|
|
24
|
+
.mypy_cache/
|
|
25
|
+
.ruff_cache/
|
|
26
|
+
|
|
27
|
+
# Testing
|
|
28
|
+
.pytest_cache/
|
|
29
|
+
.coverage
|
|
30
|
+
htmlcov/
|
|
31
|
+
|
|
32
|
+
# IDE
|
|
33
|
+
.vscode/
|
|
34
|
+
.idea/
|
|
35
|
+
*.swp
|
|
36
|
+
*.swo
|
|
37
|
+
|
|
38
|
+
# macOS
|
|
39
|
+
.DS_Store
|
|
40
|
+
|
|
41
|
+
# Local scratch / manual test scripts
|
|
42
|
+
scratch.py
|
|
43
|
+
scratch_*.py
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Revenuebase
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: revenuebase-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for the Revenuebase Email Verification and Company Resolver API.
|
|
5
|
+
Project-URL: Homepage, https://revenuebase.ai
|
|
6
|
+
Project-URL: Documentation, https://docs.revenuebase.ai
|
|
7
|
+
Project-URL: Repository, https://github.com/revenuebase/revenuebase-sdk
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/revenuebase/revenuebase-sdk/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/revenuebase/revenuebase-sdk/blob/main/CHANGELOG.md
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api,email,revenuebase,sdk,validation
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Requires-Dist: httpx>=0.24.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: respx>=0.20; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: twine>=5.0; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# Revenuebase Python SDK
|
|
37
|
+
|
|
38
|
+
Python SDK for the [Revenuebase API](https://api.revenuebase.ai) — email validation and company resolution.
|
|
39
|
+
|
|
40
|
+
## Requirements
|
|
41
|
+
|
|
42
|
+
- Python ≥ 3.8
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install revenuebase-sdk
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quickstart
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from revenuebase_sdk import RevenuebaseClient
|
|
54
|
+
|
|
55
|
+
client = RevenuebaseClient(api_key="your-api-key")
|
|
56
|
+
# Or set REVENUEBASE_API_KEY in your environment and call RevenuebaseClient()
|
|
57
|
+
|
|
58
|
+
# Validate a single email
|
|
59
|
+
result = client.email_processing.validate_email(email="user@acme.com")
|
|
60
|
+
print(result.status) # "Valid", "Invalid", or "Unknown"
|
|
61
|
+
|
|
62
|
+
# With full metadata
|
|
63
|
+
result = client.email_processing.validate_email(email="user@acme.com", metadata=True)
|
|
64
|
+
print(result.mx_record_present, result.email_provider)
|
|
65
|
+
|
|
66
|
+
# Check your credit balance
|
|
67
|
+
credits = client.user_operations.get_credits()
|
|
68
|
+
print(credits.credits)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Authentication
|
|
72
|
+
|
|
73
|
+
Pass your API key via the `api_key` parameter or the `REVENUEBASE_API_KEY` environment variable. The key is sent as the `x-key` header on every request.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export REVENUEBASE_API_KEY="your-api-key"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Resources
|
|
80
|
+
|
|
81
|
+
### `email_processing`
|
|
82
|
+
|
|
83
|
+
| Method | Description |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `validate_email(*, email, metadata=False)` | Validate a single email. Returns `Valid`, `Invalid`, or `Unknown`. |
|
|
86
|
+
| `batch_upload(*, file, filename, metadata=False)` | Upload a `.csv` or `.json` file for async batch validation. |
|
|
87
|
+
| `get_batch_status(*, process_id)` | Poll the status of a batch job. |
|
|
88
|
+
| `list_queued()` | List all active (queued or processing) batch jobs. |
|
|
89
|
+
| `cancel_batch(*, process_id)` | Cancel a queued or in-progress batch job. |
|
|
90
|
+
| `download_batch(*, process_id)` | Download the results of a completed job as bytes. |
|
|
91
|
+
| `batch_start(*, filename, metadata=False)` | *(Deprecated)* Queue a pre-uploaded file. Use `batch_upload` instead. |
|
|
92
|
+
|
|
93
|
+
### `user_operations`
|
|
94
|
+
|
|
95
|
+
| Method | Description |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `get_credits()` | Get your remaining credit balance. |
|
|
98
|
+
| `rotate_api_key()` | Generate a new API key (invalidates the previous one immediately). |
|
|
99
|
+
|
|
100
|
+
### `company_resolver`
|
|
101
|
+
|
|
102
|
+
| Method | Description |
|
|
103
|
+
|---|---|
|
|
104
|
+
| `resolve(*, company_name, result_count=3, ...)` | Match a company name to verified records using semantic search. |
|
|
105
|
+
| `discover(*, keyword, result_count=1000, ...)` | Discover companies matching a keyword or description. |
|
|
106
|
+
|
|
107
|
+
## Batch validation workflow
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import time
|
|
111
|
+
|
|
112
|
+
# 1. Upload the file
|
|
113
|
+
with open("emails.csv", "rb") as f:
|
|
114
|
+
job = client.email_processing.batch_upload(file=f, filename="emails.csv")
|
|
115
|
+
|
|
116
|
+
print(f"Job {job.process_id} queued")
|
|
117
|
+
|
|
118
|
+
# 2. Poll until complete
|
|
119
|
+
while True:
|
|
120
|
+
status = client.email_processing.get_batch_status(process_id=job.process_id)
|
|
121
|
+
print(status.current_status)
|
|
122
|
+
if status.current_status in ("COMPLETED", "ERROR", "CANCELLED"):
|
|
123
|
+
break
|
|
124
|
+
time.sleep(5)
|
|
125
|
+
|
|
126
|
+
# 3. Download results
|
|
127
|
+
if status.current_status == "COMPLETED":
|
|
128
|
+
data = client.email_processing.download_batch(process_id=job.process_id)
|
|
129
|
+
with open("results.csv", "wb") as f:
|
|
130
|
+
f.write(data)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Company resolution
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
# Match by name
|
|
137
|
+
result = client.company_resolver.resolve(
|
|
138
|
+
company_name="Stripe",
|
|
139
|
+
result_count=3,
|
|
140
|
+
headquarters_country="US",
|
|
141
|
+
)
|
|
142
|
+
for company in result.companies:
|
|
143
|
+
print(company.company_name, company.similar_score, company.headquarters_city)
|
|
144
|
+
|
|
145
|
+
# Discover by keyword
|
|
146
|
+
result = client.company_resolver.discover(
|
|
147
|
+
keyword="enterprise cybersecurity SaaS",
|
|
148
|
+
result_count=100,
|
|
149
|
+
headquarters_country="US",
|
|
150
|
+
)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Async usage
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
import asyncio
|
|
157
|
+
from revenuebase_sdk import AsyncRevenuebaseClient
|
|
158
|
+
|
|
159
|
+
async def main():
|
|
160
|
+
async with AsyncRevenuebaseClient(api_key="your-api-key") as client:
|
|
161
|
+
result = await client.email_processing.validate_email(email="user@acme.com")
|
|
162
|
+
print(result.status)
|
|
163
|
+
|
|
164
|
+
asyncio.run(main())
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Error handling
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from revenuebase_sdk import (
|
|
171
|
+
AuthenticationError,
|
|
172
|
+
BadRequestError,
|
|
173
|
+
RateLimitError,
|
|
174
|
+
APIConnectionError,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
try:
|
|
178
|
+
result = client.email_processing.validate_email(email="user@acme.com")
|
|
179
|
+
except AuthenticationError:
|
|
180
|
+
print("Invalid API key")
|
|
181
|
+
except BadRequestError as e:
|
|
182
|
+
print(f"Bad request: {e.message}")
|
|
183
|
+
except RateLimitError:
|
|
184
|
+
print("Rate limited — slow down requests")
|
|
185
|
+
except APIConnectionError as e:
|
|
186
|
+
print(f"Network error: {e.message}")
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Per-request options
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
# Override timeout for a single call
|
|
193
|
+
result = (
|
|
194
|
+
client
|
|
195
|
+
.with_options(timeout=5.0, max_retries=0)
|
|
196
|
+
.email_processing.validate_email(email="user@acme.com")
|
|
197
|
+
)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Development
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
pip install -e ".[dev]"
|
|
204
|
+
pytest
|
|
205
|
+
mypy src
|
|
206
|
+
ruff check src
|
|
207
|
+
```
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Revenuebase Python SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for the [Revenuebase API](https://api.revenuebase.ai) — email validation and company resolution.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Python ≥ 3.8
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install revenuebase-sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quickstart
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from revenuebase_sdk import RevenuebaseClient
|
|
19
|
+
|
|
20
|
+
client = RevenuebaseClient(api_key="your-api-key")
|
|
21
|
+
# Or set REVENUEBASE_API_KEY in your environment and call RevenuebaseClient()
|
|
22
|
+
|
|
23
|
+
# Validate a single email
|
|
24
|
+
result = client.email_processing.validate_email(email="user@acme.com")
|
|
25
|
+
print(result.status) # "Valid", "Invalid", or "Unknown"
|
|
26
|
+
|
|
27
|
+
# With full metadata
|
|
28
|
+
result = client.email_processing.validate_email(email="user@acme.com", metadata=True)
|
|
29
|
+
print(result.mx_record_present, result.email_provider)
|
|
30
|
+
|
|
31
|
+
# Check your credit balance
|
|
32
|
+
credits = client.user_operations.get_credits()
|
|
33
|
+
print(credits.credits)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Authentication
|
|
37
|
+
|
|
38
|
+
Pass your API key via the `api_key` parameter or the `REVENUEBASE_API_KEY` environment variable. The key is sent as the `x-key` header on every request.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
export REVENUEBASE_API_KEY="your-api-key"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Resources
|
|
45
|
+
|
|
46
|
+
### `email_processing`
|
|
47
|
+
|
|
48
|
+
| Method | Description |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `validate_email(*, email, metadata=False)` | Validate a single email. Returns `Valid`, `Invalid`, or `Unknown`. |
|
|
51
|
+
| `batch_upload(*, file, filename, metadata=False)` | Upload a `.csv` or `.json` file for async batch validation. |
|
|
52
|
+
| `get_batch_status(*, process_id)` | Poll the status of a batch job. |
|
|
53
|
+
| `list_queued()` | List all active (queued or processing) batch jobs. |
|
|
54
|
+
| `cancel_batch(*, process_id)` | Cancel a queued or in-progress batch job. |
|
|
55
|
+
| `download_batch(*, process_id)` | Download the results of a completed job as bytes. |
|
|
56
|
+
| `batch_start(*, filename, metadata=False)` | *(Deprecated)* Queue a pre-uploaded file. Use `batch_upload` instead. |
|
|
57
|
+
|
|
58
|
+
### `user_operations`
|
|
59
|
+
|
|
60
|
+
| Method | Description |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `get_credits()` | Get your remaining credit balance. |
|
|
63
|
+
| `rotate_api_key()` | Generate a new API key (invalidates the previous one immediately). |
|
|
64
|
+
|
|
65
|
+
### `company_resolver`
|
|
66
|
+
|
|
67
|
+
| Method | Description |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `resolve(*, company_name, result_count=3, ...)` | Match a company name to verified records using semantic search. |
|
|
70
|
+
| `discover(*, keyword, result_count=1000, ...)` | Discover companies matching a keyword or description. |
|
|
71
|
+
|
|
72
|
+
## Batch validation workflow
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
import time
|
|
76
|
+
|
|
77
|
+
# 1. Upload the file
|
|
78
|
+
with open("emails.csv", "rb") as f:
|
|
79
|
+
job = client.email_processing.batch_upload(file=f, filename="emails.csv")
|
|
80
|
+
|
|
81
|
+
print(f"Job {job.process_id} queued")
|
|
82
|
+
|
|
83
|
+
# 2. Poll until complete
|
|
84
|
+
while True:
|
|
85
|
+
status = client.email_processing.get_batch_status(process_id=job.process_id)
|
|
86
|
+
print(status.current_status)
|
|
87
|
+
if status.current_status in ("COMPLETED", "ERROR", "CANCELLED"):
|
|
88
|
+
break
|
|
89
|
+
time.sleep(5)
|
|
90
|
+
|
|
91
|
+
# 3. Download results
|
|
92
|
+
if status.current_status == "COMPLETED":
|
|
93
|
+
data = client.email_processing.download_batch(process_id=job.process_id)
|
|
94
|
+
with open("results.csv", "wb") as f:
|
|
95
|
+
f.write(data)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Company resolution
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
# Match by name
|
|
102
|
+
result = client.company_resolver.resolve(
|
|
103
|
+
company_name="Stripe",
|
|
104
|
+
result_count=3,
|
|
105
|
+
headquarters_country="US",
|
|
106
|
+
)
|
|
107
|
+
for company in result.companies:
|
|
108
|
+
print(company.company_name, company.similar_score, company.headquarters_city)
|
|
109
|
+
|
|
110
|
+
# Discover by keyword
|
|
111
|
+
result = client.company_resolver.discover(
|
|
112
|
+
keyword="enterprise cybersecurity SaaS",
|
|
113
|
+
result_count=100,
|
|
114
|
+
headquarters_country="US",
|
|
115
|
+
)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Async usage
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
import asyncio
|
|
122
|
+
from revenuebase_sdk import AsyncRevenuebaseClient
|
|
123
|
+
|
|
124
|
+
async def main():
|
|
125
|
+
async with AsyncRevenuebaseClient(api_key="your-api-key") as client:
|
|
126
|
+
result = await client.email_processing.validate_email(email="user@acme.com")
|
|
127
|
+
print(result.status)
|
|
128
|
+
|
|
129
|
+
asyncio.run(main())
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Error handling
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from revenuebase_sdk import (
|
|
136
|
+
AuthenticationError,
|
|
137
|
+
BadRequestError,
|
|
138
|
+
RateLimitError,
|
|
139
|
+
APIConnectionError,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
try:
|
|
143
|
+
result = client.email_processing.validate_email(email="user@acme.com")
|
|
144
|
+
except AuthenticationError:
|
|
145
|
+
print("Invalid API key")
|
|
146
|
+
except BadRequestError as e:
|
|
147
|
+
print(f"Bad request: {e.message}")
|
|
148
|
+
except RateLimitError:
|
|
149
|
+
print("Rate limited — slow down requests")
|
|
150
|
+
except APIConnectionError as e:
|
|
151
|
+
print(f"Network error: {e.message}")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Per-request options
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
# Override timeout for a single call
|
|
158
|
+
result = (
|
|
159
|
+
client
|
|
160
|
+
.with_options(timeout=5.0, max_retries=0)
|
|
161
|
+
.email_processing.validate_email(email="user@acme.com")
|
|
162
|
+
)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Development
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
pip install -e ".[dev]"
|
|
169
|
+
pytest
|
|
170
|
+
mypy src
|
|
171
|
+
ruff check src
|
|
172
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "revenuebase-sdk"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Python SDK for the Revenuebase Email Verification and Company Resolver API."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
keywords = ["api", "sdk", "email", "validation", "revenuebase"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.8",
|
|
19
|
+
"Programming Language :: Python :: 3.9",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"httpx>=0.24.0",
|
|
27
|
+
"pydantic>=2.0.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://revenuebase.ai"
|
|
32
|
+
Documentation = "https://docs.revenuebase.ai"
|
|
33
|
+
Repository = "https://github.com/revenuebase/revenuebase-sdk"
|
|
34
|
+
"Bug Tracker" = "https://github.com/revenuebase/revenuebase-sdk/issues"
|
|
35
|
+
Changelog = "https://github.com/revenuebase/revenuebase-sdk/blob/main/CHANGELOG.md"
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=7.0",
|
|
40
|
+
"pytest-asyncio>=0.21",
|
|
41
|
+
"respx>=0.20",
|
|
42
|
+
"mypy>=1.0",
|
|
43
|
+
"ruff>=0.4.0",
|
|
44
|
+
"build>=1.0",
|
|
45
|
+
"twine>=5.0",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.hatch.version]
|
|
49
|
+
path = "src/revenuebase_sdk/_version.py"
|
|
50
|
+
pattern = '__version__ = "(?P<version>[^"]+)"'
|
|
51
|
+
|
|
52
|
+
[tool.hatch.build.targets.wheel]
|
|
53
|
+
packages = ["src/revenuebase_sdk"]
|
|
54
|
+
exclude = ["src/revenuebase_sdk/snowflake"]
|
|
55
|
+
|
|
56
|
+
[tool.hatch.build.targets.sdist]
|
|
57
|
+
include = ["src/revenuebase_sdk/**", "tests/**", "README.md"]
|
|
58
|
+
|
|
59
|
+
[tool.pytest.ini_options]
|
|
60
|
+
asyncio_mode = "auto"
|
|
61
|
+
testpaths = ["tests"]
|
|
62
|
+
|
|
63
|
+
[tool.mypy]
|
|
64
|
+
strict = true
|
|
65
|
+
files = ["src"]
|
|
66
|
+
python_version = "3.8"
|
|
67
|
+
|
|
68
|
+
[tool.ruff]
|
|
69
|
+
target-version = "py38"
|
|
70
|
+
line-length = 100
|
|
71
|
+
|
|
72
|
+
[tool.ruff.lint]
|
|
73
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
74
|
+
ignore = ["E501"]
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint.isort]
|
|
77
|
+
known-first-party = ["revenuebase_sdk"]
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Revenuebase Python SDK — email validation and company resolution.
|
|
3
|
+
|
|
4
|
+
Usage::
|
|
5
|
+
|
|
6
|
+
from revenuebase_sdk import RevenuebaseClient
|
|
7
|
+
|
|
8
|
+
client = RevenuebaseClient(api_key="your-api-key")
|
|
9
|
+
result = client.email_processing.validate_email(email="user@acme.com")
|
|
10
|
+
print(result.status) # "Valid", "Invalid", or "Unknown"
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from ._version import __version__ as __version__
|
|
15
|
+
from ._client import RevenuebaseClient as RevenuebaseClient
|
|
16
|
+
from ._client import AsyncRevenuebaseClient as AsyncRevenuebaseClient
|
|
17
|
+
from ._exceptions import (
|
|
18
|
+
RevenuebaseError as RevenuebaseError,
|
|
19
|
+
APIError as APIError,
|
|
20
|
+
APIConnectionError as APIConnectionError,
|
|
21
|
+
APITimeoutError as APITimeoutError,
|
|
22
|
+
APIStatusError as APIStatusError,
|
|
23
|
+
APIResponseValidationError as APIResponseValidationError,
|
|
24
|
+
BadRequestError as BadRequestError,
|
|
25
|
+
AuthenticationError as AuthenticationError,
|
|
26
|
+
PermissionDeniedError as PermissionDeniedError,
|
|
27
|
+
NotFoundError as NotFoundError,
|
|
28
|
+
ConflictError as ConflictError,
|
|
29
|
+
UnprocessableEntityError as UnprocessableEntityError,
|
|
30
|
+
RateLimitError as RateLimitError,
|
|
31
|
+
InternalServerError as InternalServerError,
|
|
32
|
+
)
|
|
33
|
+
from .types import (
|
|
34
|
+
CreditsResponse as CreditsResponse,
|
|
35
|
+
NewKeyResponse as NewKeyResponse,
|
|
36
|
+
EmailValidationResponse as EmailValidationResponse,
|
|
37
|
+
BatchEmailResponse as BatchEmailResponse,
|
|
38
|
+
BatchEmailStatusResponse as BatchEmailStatusResponse,
|
|
39
|
+
Process as Process,
|
|
40
|
+
QueuedProcessesResponse as QueuedProcessesResponse,
|
|
41
|
+
Company as Company,
|
|
42
|
+
CompanyResolverResponse as CompanyResolverResponse,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
__all__ = [
|
|
46
|
+
"__version__",
|
|
47
|
+
"RevenuebaseClient",
|
|
48
|
+
"AsyncRevenuebaseClient",
|
|
49
|
+
# Exceptions
|
|
50
|
+
"RevenuebaseError",
|
|
51
|
+
"APIError",
|
|
52
|
+
"APIConnectionError",
|
|
53
|
+
"APITimeoutError",
|
|
54
|
+
"APIStatusError",
|
|
55
|
+
"APIResponseValidationError",
|
|
56
|
+
"BadRequestError",
|
|
57
|
+
"AuthenticationError",
|
|
58
|
+
"PermissionDeniedError",
|
|
59
|
+
"NotFoundError",
|
|
60
|
+
"ConflictError",
|
|
61
|
+
"UnprocessableEntityError",
|
|
62
|
+
"RateLimitError",
|
|
63
|
+
"InternalServerError",
|
|
64
|
+
# Types
|
|
65
|
+
"CreditsResponse",
|
|
66
|
+
"NewKeyResponse",
|
|
67
|
+
"EmailValidationResponse",
|
|
68
|
+
"BatchEmailResponse",
|
|
69
|
+
"BatchEmailStatusResponse",
|
|
70
|
+
"Process",
|
|
71
|
+
"QueuedProcessesResponse",
|
|
72
|
+
"Company",
|
|
73
|
+
"CompanyResolverResponse",
|
|
74
|
+
]
|