billionverify 1.2.2__tar.gz → 1.3.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,24 @@
1
+ # Changelog
2
+
3
+ ## 1.3.0
4
+
5
+ Covers every operation of the current BillionVerify API, on both the sync and the async client.
6
+
7
+ ### Added
8
+
9
+ - `check_disposable`, `check_disposable_via_query` (the free disposable-domain lookup).
10
+ - `resume_job` for paused file jobs; `get_file_job_status` and `wait_for_file_job` as aliases of the existing `*_file_task_*` methods.
11
+ - 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`.
12
+ - `verify_bulk` takes `force_refresh` and `include_domain_reputation`.
13
+ - `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).
14
+ - 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.
15
+
16
+ ### Changed
17
+
18
+ - `wait_for_file_task` also returns on `completed_with_warning`, `cancelled` and `paused`; it used to poll until it timed out on those.
19
+ - `list_webhooks` reads the `webhooks` list the API returns (a bare list is still accepted); it failed against the real API before.
20
+ - 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`.
21
+ - `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.
22
+ - `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.
23
+ - A retried file upload sends the whole file again (the file position was not reset before).
24
+ - 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.3.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}")
@@ -149,12 +148,17 @@ status = client.get_file_task_status(
149
148
  print(f"Progress: {status.progress}%")
150
149
  print(f"Processed: {status.processed_emails}/{status.total_emails}")
151
150
 
152
- # Wait for completion (polling)
151
+ # Wait until the task stops moving on its own (polling). Returns on completed,
152
+ # completed_with_warning, failed, cancelled or paused.
153
153
  completed = client.wait_for_file_task(
154
154
  task_id=task.task_id,
155
155
  poll_interval=5.0, # seconds
156
156
  max_wait=600.0, # seconds
157
157
  )
158
+ print(completed.deliverability_buckets.strict_deliverable)
159
+
160
+ # A paused task continues with:
161
+ client.resume_job(task.task_id)
158
162
 
159
163
  # Download results as CSV with optional filters
160
164
  output_file = client.download_file_results(
@@ -171,6 +175,37 @@ output_file = client.download_file_results(
171
175
  print(f"Results saved to: {output_file}")
172
176
  ```
173
177
 
178
+ `get_file_job_status` and `wait_for_file_job` are aliases of `get_file_task_status` and `wait_for_file_task`.
179
+
180
+ 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.
181
+
182
+ ## Free Disposable Check
183
+
184
+ ```python
185
+ client.check_disposable("someone@mailinator.com").is_disposable # POST
186
+ client.check_disposable_via_query("someone@mailinator.com").is_disposable # GET
187
+ ```
188
+
189
+ ## Domain Search
190
+
191
+ 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.
192
+
193
+ ```python
194
+ search = client.create_domain_search("example.com", max_emails=20, include_role_based=False, max_pages=100)
195
+ done = client.wait_for_domain_search(search.search_id) # completed, completed_with_warning or failed
196
+ for item in done.result["emails"]:
197
+ print(item["email"])
198
+
199
+ # A CSV of domains
200
+ batch = client.create_domain_search_batch("domains.csv", max_emails=10, column_map={"domain": "Company Website"})
201
+ client.get_domain_search_batch(batch.batch_id).progress.processed
202
+ client.list_domain_search_batches(limit=20, status="completed").items
203
+ csv_text = client.download_domain_search_batch_results(batch.batch_id) # 409 until the batch has finished
204
+ client.download_domain_search_batch_results(batch.batch_id, "batch.csv") # or save to a file
205
+ ```
206
+
207
+ The async client has the same methods (`await client.create_domain_search(...)`).
208
+
174
209
  ## Async Support
175
210
 
176
211
  ```python
@@ -235,16 +270,20 @@ for wh in webhooks:
235
270
  # Delete a webhook
236
271
  client.delete_webhook(webhook.id)
237
272
 
238
- # Verify webhook signature
239
- from billionverify import BillionVerify
273
+ # Verify a delivery
274
+ from billionverify import verify_webhook_delivery
240
275
 
241
- is_valid = BillionVerify.verify_webhook_signature(
242
- payload=raw_body,
243
- signature=signature_header,
276
+ is_valid = verify_webhook_delivery(
277
+ payload=raw_body, # exactly as received
278
+ signature=headers["X-Webhook-Signature"], # sha256=<hex>
279
+ timestamp=headers["X-Webhook-Timestamp"], # Unix seconds
244
280
  secret="your-webhook-secret",
281
+ tolerance=300, # deliveries older (or newer) than this are rejected; 0 turns the check off
245
282
  )
246
283
  ```
247
284
 
285
+ 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`.
286
+
248
287
  ## Error Handling
249
288
 
250
289
  ```python
@@ -325,6 +364,7 @@ from billionverify import (
325
364
  FileUploadResponse,
326
365
  FileTaskStatus,
327
366
  CreditsResponse,
367
+ DomainSearchStatus,
328
368
  VerificationStatus,
329
369
  )
330
370
 
@@ -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}")
@@ -118,12 +117,17 @@ status = client.get_file_task_status(
118
117
  print(f"Progress: {status.progress}%")
119
118
  print(f"Processed: {status.processed_emails}/{status.total_emails}")
120
119
 
121
- # Wait for completion (polling)
120
+ # Wait until the task stops moving on its own (polling). Returns on completed,
121
+ # completed_with_warning, failed, cancelled or paused.
122
122
  completed = client.wait_for_file_task(
123
123
  task_id=task.task_id,
124
124
  poll_interval=5.0, # seconds
125
125
  max_wait=600.0, # seconds
126
126
  )
127
+ print(completed.deliverability_buckets.strict_deliverable)
128
+
129
+ # A paused task continues with:
130
+ client.resume_job(task.task_id)
127
131
 
128
132
  # Download results as CSV with optional filters
129
133
  output_file = client.download_file_results(
@@ -140,6 +144,37 @@ output_file = client.download_file_results(
140
144
  print(f"Results saved to: {output_file}")
141
145
  ```
142
146
 
147
+ `get_file_job_status` and `wait_for_file_job` are aliases of `get_file_task_status` and `wait_for_file_task`.
148
+
149
+ 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.
150
+
151
+ ## Free Disposable Check
152
+
153
+ ```python
154
+ client.check_disposable("someone@mailinator.com").is_disposable # POST
155
+ client.check_disposable_via_query("someone@mailinator.com").is_disposable # GET
156
+ ```
157
+
158
+ ## Domain Search
159
+
160
+ 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.
161
+
162
+ ```python
163
+ search = client.create_domain_search("example.com", max_emails=20, include_role_based=False, max_pages=100)
164
+ done = client.wait_for_domain_search(search.search_id) # completed, completed_with_warning or failed
165
+ for item in done.result["emails"]:
166
+ print(item["email"])
167
+
168
+ # A CSV of domains
169
+ batch = client.create_domain_search_batch("domains.csv", max_emails=10, column_map={"domain": "Company Website"})
170
+ client.get_domain_search_batch(batch.batch_id).progress.processed
171
+ client.list_domain_search_batches(limit=20, status="completed").items
172
+ csv_text = client.download_domain_search_batch_results(batch.batch_id) # 409 until the batch has finished
173
+ client.download_domain_search_batch_results(batch.batch_id, "batch.csv") # or save to a file
174
+ ```
175
+
176
+ The async client has the same methods (`await client.create_domain_search(...)`).
177
+
143
178
  ## Async Support
144
179
 
145
180
  ```python
@@ -204,16 +239,20 @@ for wh in webhooks:
204
239
  # Delete a webhook
205
240
  client.delete_webhook(webhook.id)
206
241
 
207
- # Verify webhook signature
208
- from billionverify import BillionVerify
242
+ # Verify a delivery
243
+ from billionverify import verify_webhook_delivery
209
244
 
210
- is_valid = BillionVerify.verify_webhook_signature(
211
- payload=raw_body,
212
- signature=signature_header,
245
+ is_valid = verify_webhook_delivery(
246
+ payload=raw_body, # exactly as received
247
+ signature=headers["X-Webhook-Signature"], # sha256=<hex>
248
+ timestamp=headers["X-Webhook-Timestamp"], # Unix seconds
213
249
  secret="your-webhook-secret",
250
+ tolerance=300, # deliveries older (or newer) than this are rejected; 0 turns the check off
214
251
  )
215
252
  ```
216
253
 
254
+ 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`.
255
+
217
256
  ## Error Handling
218
257
 
219
258
  ```python
@@ -294,6 +333,7 @@ from billionverify import (
294
333
  FileUploadResponse,
295
334
  FileTaskStatus,
296
335
  CreditsResponse,
336
+ DomainSearchStatus,
297
337
  VerificationStatus,
298
338
  )
299
339
 
@@ -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,15 @@ 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,
18
26
  FileTaskStatus,
19
27
  FileUploadResponse,
20
28
  HealthCheckResponse,
@@ -26,7 +34,7 @@ from .types import (
26
34
  WebhookEvent,
27
35
  )
28
36
 
29
- __version__ = "1.2.2"
37
+ __version__ = "1.3.0"
30
38
 
31
39
  __all__ = [
32
40
  # Clients
@@ -43,6 +51,16 @@ __all__ = [
43
51
  "CreditsResponse",
44
52
  "HealthCheckResponse",
45
53
  "DomainReputation",
54
+ "DeliverabilityBuckets",
55
+ "DisposableCheck",
56
+ "DomainSearchCreated",
57
+ "DomainSearchStatus",
58
+ "DomainSearchBatchCreated",
59
+ "DomainSearchBatchProgress",
60
+ "DomainSearchBatchStatus",
61
+ "DomainSearchBatchPage",
62
+ # Helpers
63
+ "verify_webhook_delivery",
46
64
  "JobStatus",
47
65
  "Webhook",
48
66
  "WebhookEvent",