billionverify 1.2.2__tar.gz → 1.4.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.
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ ## 1.4.0
4
+
5
+ ### Added
6
+
7
+ - `list_file_jobs(limit, status, cursor)` on both clients for `GET /v1/verify/file`: one page of file jobs, newest first, as `FileJobPage` with `FileJobListItem` items, `has_more` and `next_cursor`.
8
+ - `file_name` on `FileTaskStatus`.
9
+ - `WebhookEvent` includes `domain_search.completed` and `domain_search.batch_completed`.
10
+
11
+ ### Changed
12
+
13
+ - `get_file_task_status` / `get_file_job_status` accept a `timeout` of 0-90 seconds (was 0-300). The server returns as soon as the task is completed, completed_with_warning, failed, cancelled or paused, with the same full status as without `timeout`.
14
+
15
+ ## 1.3.0
16
+
17
+ Covers every operation of the current BillionVerify API, on both the sync and the async client.
18
+
19
+ ### Added
20
+
21
+ - `check_disposable`, `check_disposable_via_query` (the free disposable-domain lookup).
22
+ - `resume_job` for paused file jobs; `get_file_job_status` and `wait_for_file_job` as aliases of the existing `*_file_task_*` methods.
23
+ - Domain search: `create_domain_search`, `get_domain_search`, `wait_for_domain_search`, `create_domain_search_batch`, `list_domain_search_batches`, `get_domain_search_batch`, `download_domain_search_batch_results`.
24
+ - `verify_bulk` takes `force_refresh` and `include_domain_reputation`.
25
+ - `verify_webhook_delivery` (also a static method on both clients): checks the HMAC over `"<timestamp>.<raw body>"`, which is how the server signs, and the age of the delivery (default 300 seconds).
26
+ - New result fields: `deliverability_buckets`, `retryable_emails`, `deferred_emails`, `retry_after_seconds` on bulk responses; `verification_mode`, `retryable`, `risk_reasons`, `smtp_result`, `catch_all_evidence`, `alias_of`, `mx_ip`, `mx_asn`, `mx_as_org`, `smtputf8` and more on results; `stage`, `pending_retry_emails`, `capacity_wait`, `runtime_hints`, `deliverability_buckets`, `result_download_*` and more on file task status; `last_delivery_*` on webhooks; `time` on the health response; `email_column_candidates` on uploads.
27
+
28
+ ### Changed
29
+
30
+ - `wait_for_file_task` also returns on `completed_with_warning`, `cancelled` and `paused`; it used to poll until it timed out on those.
31
+ - `list_webhooks` reads the `webhooks` list the API returns (a bare list is still accepted); it failed against the real API before.
32
+ - Bulk and single results no longer require fields the API may leave out; only `email` and `status` are required. `DomainReputation` keeps `from_dict` from 1.2.2 (unknown fields ignored) and adds `drop_attribution`.
33
+ - `check_smtp` (verify, verify_bulk, upload_file) defaults to `None`: it is not sent unless you set it, so the server default applies. `upload_file` no longer sends `preserve_original=false` by default; the server default is true.
34
+ - `download_file_results` follows the pre-signed redirect itself and does not send `BV-API-KEY` to the storage host (httpx used to forward it). Error messages no longer carry the query string of a URL.
35
+ - A retried file upload sends the whole file again (the file position was not reset before).
36
+ - The old three-argument `verify_webhook_signature` is kept, documented as not matching real deliveries, and returns `False` for a blank secret.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: billionverify
3
- Version: 1.2.2
3
+ Version: 1.4.0
4
4
  Summary: BillionVerify Python SDK - Official SDK for BillionVerify email verification API
5
5
  Project-URL: Homepage, https://billionverify.com
6
6
  Project-URL: Documentation, https://billionverify.com/docs
@@ -76,7 +76,7 @@ Uses the `/verify/single` endpoint:
76
76
  ```python
77
77
  result = client.verify(
78
78
  email="user@example.com",
79
- check_smtp=True, # Optional: Perform SMTP verification (default: True)
79
+ check_smtp=None, # Optional: force SMTP on/off; left out, the server default applies
80
80
  force_refresh=False, # Optional: Bypass cache and force live verification (default: False)
81
81
  include_domain_reputation=False, # Optional: Include domain reputation details (default: False)
82
82
  )
@@ -132,9 +132,8 @@ For large lists, use `upload_file()` for asynchronous file verification:
132
132
  # Upload a file for async verification
133
133
  task = client.upload_file(
134
134
  file_path="emails.csv",
135
- check_smtp=True,
136
135
  email_column="email", # Column name for CSV files
137
- preserve_original=True, # Keep original columns in results
136
+ preserve_original=True, # Optional; left out, the server default (True) applies
138
137
  )
139
138
 
140
139
  print(f"Task ID: {task.task_id}")
@@ -144,17 +143,28 @@ print(f"Estimated count: {task.estimated_count}")
144
143
  # Get task status (with optional long-polling)
145
144
  status = client.get_file_task_status(
146
145
  task_id=task.task_id,
147
- timeout=60, # Long-poll for up to 60 seconds (0-300)
146
+ timeout=60, # Long-poll for up to 60 seconds (0-90); returns early once the task ends or pauses
148
147
  )
148
+ print(f"File: {status.file_name}")
149
149
  print(f"Progress: {status.progress}%")
150
150
  print(f"Processed: {status.processed_emails}/{status.total_emails}")
151
151
 
152
- # Wait for completion (polling)
152
+ # List tasks, newest first (one page; pass next_cursor as cursor while has_more)
153
+ page = client.list_file_jobs(limit=20, status="completed")
154
+ for job in page.items:
155
+ print(job.task_id, job.file_name, job.status)
156
+
157
+ # Wait until the task stops moving on its own (polling). Returns on completed,
158
+ # completed_with_warning, failed, cancelled or paused.
153
159
  completed = client.wait_for_file_task(
154
160
  task_id=task.task_id,
155
161
  poll_interval=5.0, # seconds
156
162
  max_wait=600.0, # seconds
157
163
  )
164
+ print(completed.deliverability_buckets.strict_deliverable)
165
+
166
+ # A paused task continues with:
167
+ client.resume_job(task.task_id)
158
168
 
159
169
  # Download results as CSV with optional filters
160
170
  output_file = client.download_file_results(
@@ -171,6 +181,37 @@ output_file = client.download_file_results(
171
181
  print(f"Results saved to: {output_file}")
172
182
  ```
173
183
 
184
+ `get_file_job_status` and `wait_for_file_job` are aliases of `get_file_task_status` and `wait_for_file_task`.
185
+
186
+ Result files are served from a pre-signed storage URL. The SDK follows that redirect itself and does not send your API key to the storage host.
187
+
188
+ ## Free Disposable Check
189
+
190
+ ```python
191
+ client.check_disposable("someone@mailinator.com").is_disposable # POST
192
+ client.check_disposable_via_query("someone@mailinator.com").is_disposable # GET
193
+ ```
194
+
195
+ ## Domain Search
196
+
197
+ Give a domain, get the emails published on its site, each one verified. It runs asynchronously and costs 5 credits per returned email; `max_emails` (1-200) caps the bill.
198
+
199
+ ```python
200
+ search = client.create_domain_search("example.com", max_emails=20, include_role_based=False, max_pages=100)
201
+ done = client.wait_for_domain_search(search.search_id) # completed, completed_with_warning or failed
202
+ for item in done.result["emails"]:
203
+ print(item["email"])
204
+
205
+ # A CSV of domains
206
+ batch = client.create_domain_search_batch("domains.csv", max_emails=10, column_map={"domain": "Company Website"})
207
+ client.get_domain_search_batch(batch.batch_id).progress.processed
208
+ client.list_domain_search_batches(limit=20, status="completed").items
209
+ csv_text = client.download_domain_search_batch_results(batch.batch_id) # 409 until the batch has finished
210
+ client.download_domain_search_batch_results(batch.batch_id, "batch.csv") # or save to a file
211
+ ```
212
+
213
+ The async client has the same methods (`await client.create_domain_search(...)`).
214
+
174
215
  ## Async Support
175
216
 
176
217
  ```python
@@ -222,7 +263,7 @@ Webhooks support events: `file.completed`, `file.failed`
222
263
  # Create a webhook
223
264
  webhook = client.create_webhook(
224
265
  url="https://your-app.com/webhooks/billionverify",
225
- events=["file.completed", "file.failed"],
266
+ events=["file.completed", "file.failed", "domain_search.completed", "domain_search.batch_completed"],
226
267
  )
227
268
  print(f"Webhook ID: {webhook.id}")
228
269
  print(f"Secret: {webhook.secret}") # Save this for signature verification
@@ -235,16 +276,22 @@ for wh in webhooks:
235
276
  # Delete a webhook
236
277
  client.delete_webhook(webhook.id)
237
278
 
238
- # Verify webhook signature
239
- from billionverify import BillionVerify
279
+ # Verify a delivery
280
+ from billionverify import verify_webhook_delivery
240
281
 
241
- is_valid = BillionVerify.verify_webhook_signature(
242
- payload=raw_body,
243
- signature=signature_header,
282
+ is_valid = verify_webhook_delivery(
283
+ payload=raw_body, # exactly as received
284
+ signature=headers["X-Webhook-Signature"], # sha256=<hex>
285
+ timestamp=headers["X-Webhook-Timestamp"], # Unix seconds
244
286
  secret="your-webhook-secret",
287
+ tolerance=300, # deliveries older (or newer) than this are rejected; 0 turns the check off
245
288
  )
246
289
  ```
247
290
 
291
+ Events: `file.completed` (job finished as `completed` or `completed_with_warning`), `file.failed`, `domain_search.completed` (a domain search ended; `data.status` is `completed`, `completed_with_warning` or `failed`, `data.search_id` identifies it) and `domain_search.batch_completed` (a batch ended with the same three statuses; `data.batch_id`). Every delivery carries an `X-Webhook-Delivery-ID` header; failed deliveries are retried, so the same ID can arrive more than once, and handlers should be idempotent.
292
+
293
+ The server signs `"<timestamp>.<raw body>"` with HMAC-SHA256. `BillionVerify.verify_webhook_signature(payload, signature, secret)`, which checks the body alone, does not match a real delivery; use `verify_webhook_delivery`. A blank secret or a malformed timestamp always returns `False`.
294
+
248
295
  ## Error Handling
249
296
 
250
297
  ```python
@@ -325,6 +372,7 @@ from billionverify import (
325
372
  FileUploadResponse,
326
373
  FileTaskStatus,
327
374
  CreditsResponse,
375
+ DomainSearchStatus,
328
376
  VerificationStatus,
329
377
  )
330
378
 
@@ -45,7 +45,7 @@ Uses the `/verify/single` endpoint:
45
45
  ```python
46
46
  result = client.verify(
47
47
  email="user@example.com",
48
- check_smtp=True, # Optional: Perform SMTP verification (default: True)
48
+ check_smtp=None, # Optional: force SMTP on/off; left out, the server default applies
49
49
  force_refresh=False, # Optional: Bypass cache and force live verification (default: False)
50
50
  include_domain_reputation=False, # Optional: Include domain reputation details (default: False)
51
51
  )
@@ -101,9 +101,8 @@ For large lists, use `upload_file()` for asynchronous file verification:
101
101
  # Upload a file for async verification
102
102
  task = client.upload_file(
103
103
  file_path="emails.csv",
104
- check_smtp=True,
105
104
  email_column="email", # Column name for CSV files
106
- preserve_original=True, # Keep original columns in results
105
+ preserve_original=True, # Optional; left out, the server default (True) applies
107
106
  )
108
107
 
109
108
  print(f"Task ID: {task.task_id}")
@@ -113,17 +112,28 @@ print(f"Estimated count: {task.estimated_count}")
113
112
  # Get task status (with optional long-polling)
114
113
  status = client.get_file_task_status(
115
114
  task_id=task.task_id,
116
- timeout=60, # Long-poll for up to 60 seconds (0-300)
115
+ timeout=60, # Long-poll for up to 60 seconds (0-90); returns early once the task ends or pauses
117
116
  )
117
+ print(f"File: {status.file_name}")
118
118
  print(f"Progress: {status.progress}%")
119
119
  print(f"Processed: {status.processed_emails}/{status.total_emails}")
120
120
 
121
- # Wait for completion (polling)
121
+ # List tasks, newest first (one page; pass next_cursor as cursor while has_more)
122
+ page = client.list_file_jobs(limit=20, status="completed")
123
+ for job in page.items:
124
+ print(job.task_id, job.file_name, job.status)
125
+
126
+ # Wait until the task stops moving on its own (polling). Returns on completed,
127
+ # completed_with_warning, failed, cancelled or paused.
122
128
  completed = client.wait_for_file_task(
123
129
  task_id=task.task_id,
124
130
  poll_interval=5.0, # seconds
125
131
  max_wait=600.0, # seconds
126
132
  )
133
+ print(completed.deliverability_buckets.strict_deliverable)
134
+
135
+ # A paused task continues with:
136
+ client.resume_job(task.task_id)
127
137
 
128
138
  # Download results as CSV with optional filters
129
139
  output_file = client.download_file_results(
@@ -140,6 +150,37 @@ output_file = client.download_file_results(
140
150
  print(f"Results saved to: {output_file}")
141
151
  ```
142
152
 
153
+ `get_file_job_status` and `wait_for_file_job` are aliases of `get_file_task_status` and `wait_for_file_task`.
154
+
155
+ Result files are served from a pre-signed storage URL. The SDK follows that redirect itself and does not send your API key to the storage host.
156
+
157
+ ## Free Disposable Check
158
+
159
+ ```python
160
+ client.check_disposable("someone@mailinator.com").is_disposable # POST
161
+ client.check_disposable_via_query("someone@mailinator.com").is_disposable # GET
162
+ ```
163
+
164
+ ## Domain Search
165
+
166
+ Give a domain, get the emails published on its site, each one verified. It runs asynchronously and costs 5 credits per returned email; `max_emails` (1-200) caps the bill.
167
+
168
+ ```python
169
+ search = client.create_domain_search("example.com", max_emails=20, include_role_based=False, max_pages=100)
170
+ done = client.wait_for_domain_search(search.search_id) # completed, completed_with_warning or failed
171
+ for item in done.result["emails"]:
172
+ print(item["email"])
173
+
174
+ # A CSV of domains
175
+ batch = client.create_domain_search_batch("domains.csv", max_emails=10, column_map={"domain": "Company Website"})
176
+ client.get_domain_search_batch(batch.batch_id).progress.processed
177
+ client.list_domain_search_batches(limit=20, status="completed").items
178
+ csv_text = client.download_domain_search_batch_results(batch.batch_id) # 409 until the batch has finished
179
+ client.download_domain_search_batch_results(batch.batch_id, "batch.csv") # or save to a file
180
+ ```
181
+
182
+ The async client has the same methods (`await client.create_domain_search(...)`).
183
+
143
184
  ## Async Support
144
185
 
145
186
  ```python
@@ -191,7 +232,7 @@ Webhooks support events: `file.completed`, `file.failed`
191
232
  # Create a webhook
192
233
  webhook = client.create_webhook(
193
234
  url="https://your-app.com/webhooks/billionverify",
194
- events=["file.completed", "file.failed"],
235
+ events=["file.completed", "file.failed", "domain_search.completed", "domain_search.batch_completed"],
195
236
  )
196
237
  print(f"Webhook ID: {webhook.id}")
197
238
  print(f"Secret: {webhook.secret}") # Save this for signature verification
@@ -204,16 +245,22 @@ for wh in webhooks:
204
245
  # Delete a webhook
205
246
  client.delete_webhook(webhook.id)
206
247
 
207
- # Verify webhook signature
208
- from billionverify import BillionVerify
248
+ # Verify a delivery
249
+ from billionverify import verify_webhook_delivery
209
250
 
210
- is_valid = BillionVerify.verify_webhook_signature(
211
- payload=raw_body,
212
- signature=signature_header,
251
+ is_valid = verify_webhook_delivery(
252
+ payload=raw_body, # exactly as received
253
+ signature=headers["X-Webhook-Signature"], # sha256=<hex>
254
+ timestamp=headers["X-Webhook-Timestamp"], # Unix seconds
213
255
  secret="your-webhook-secret",
256
+ tolerance=300, # deliveries older (or newer) than this are rejected; 0 turns the check off
214
257
  )
215
258
  ```
216
259
 
260
+ Events: `file.completed` (job finished as `completed` or `completed_with_warning`), `file.failed`, `domain_search.completed` (a domain search ended; `data.status` is `completed`, `completed_with_warning` or `failed`, `data.search_id` identifies it) and `domain_search.batch_completed` (a batch ended with the same three statuses; `data.batch_id`). Every delivery carries an `X-Webhook-Delivery-ID` header; failed deliveries are retried, so the same ID can arrive more than once, and handlers should be idempotent.
261
+
262
+ The server signs `"<timestamp>.<raw body>"` with HMAC-SHA256. `BillionVerify.verify_webhook_signature(payload, signature, secret)`, which checks the body alone, does not match a real delivery; use `verify_webhook_delivery`. A blank secret or a malformed timestamp always returns `False`.
263
+
217
264
  ## Error Handling
218
265
 
219
266
  ```python
@@ -294,6 +341,7 @@ from billionverify import (
294
341
  FileUploadResponse,
295
342
  FileTaskStatus,
296
343
  CreditsResponse,
344
+ DomainSearchStatus,
297
345
  VerificationStatus,
298
346
  )
299
347
 
@@ -1,6 +1,6 @@
1
1
  """BillionVerify Python SDK - Official SDK for BillionVerify email verification API."""
2
2
 
3
- from .client import AsyncBillionVerify, BillionVerify
3
+ from .client import AsyncBillionVerify, BillionVerify, verify_webhook_delivery
4
4
  from .exceptions import (
5
5
  AuthenticationError,
6
6
  BillionVerifyError,
@@ -14,7 +14,17 @@ from .types import (
14
14
  BulkVerificationResult,
15
15
  BulkVerifyResponse,
16
16
  CreditsResponse,
17
+ DeliverabilityBuckets,
18
+ DisposableCheck,
17
19
  DomainReputation,
20
+ DomainSearchBatchCreated,
21
+ DomainSearchBatchPage,
22
+ DomainSearchBatchProgress,
23
+ DomainSearchBatchStatus,
24
+ DomainSearchCreated,
25
+ DomainSearchStatus,
26
+ FileJobListItem,
27
+ FileJobPage,
18
28
  FileTaskStatus,
19
29
  FileUploadResponse,
20
30
  HealthCheckResponse,
@@ -26,7 +36,7 @@ from .types import (
26
36
  WebhookEvent,
27
37
  )
28
38
 
29
- __version__ = "1.2.2"
39
+ __version__ = "1.4.0"
30
40
 
31
41
  __all__ = [
32
42
  # Clients
@@ -40,9 +50,21 @@ __all__ = [
40
50
  "BulkVerifyResponse",
41
51
  "FileUploadResponse",
42
52
  "FileTaskStatus",
53
+ "FileJobListItem",
54
+ "FileJobPage",
43
55
  "CreditsResponse",
44
56
  "HealthCheckResponse",
45
57
  "DomainReputation",
58
+ "DeliverabilityBuckets",
59
+ "DisposableCheck",
60
+ "DomainSearchCreated",
61
+ "DomainSearchStatus",
62
+ "DomainSearchBatchCreated",
63
+ "DomainSearchBatchProgress",
64
+ "DomainSearchBatchStatus",
65
+ "DomainSearchBatchPage",
66
+ # Helpers
67
+ "verify_webhook_delivery",
46
68
  "JobStatus",
47
69
  "Webhook",
48
70
  "WebhookEvent",