AD-SearchAPI 2.0.1__tar.gz → 2.0.2__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.
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/AD_SearchAPI.egg-info/PKG-INFO +38 -44
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/AD_SearchAPI.egg-info/requires.txt +0 -1
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/LICENSE +1 -1
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/PKG-INFO +38 -44
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/README.md +36 -41
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/search_api/__init__.py +2 -0
- ad_searchapi-2.0.2/search_api/client.py +1493 -0
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/search_api/models.py +270 -11
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/setup.py +1 -3
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/tests/test_client.py +1 -16
- ad_searchapi-2.0.1/search_api/client.py +0 -891
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/AD_SearchAPI.egg-info/SOURCES.txt +0 -0
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/AD_SearchAPI.egg-info/dependency_links.txt +0 -0
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/AD_SearchAPI.egg-info/top_level.txt +0 -0
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/search_api/exceptions.py +0 -0
- {ad_searchapi-2.0.1 → ad_searchapi-2.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AD-SearchAPI
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: A comprehensive Python client library for the Search API with enhanced error handling and balance management
|
|
5
5
|
Home-page: https://github.com/AntiChrist-Coder/search_api_library
|
|
6
6
|
Author: Search API Team
|
|
@@ -8,7 +8,7 @@ Author-email: support@search-api.dev
|
|
|
8
8
|
Project-URL: Bug Reports, https://github.com/AntiChrist-Coder/search_api_library/issues
|
|
9
9
|
Project-URL: Source, https://github.com/AntiChrist-Coder/search_api_library
|
|
10
10
|
Project-URL: Documentation, https://github.com/AntiChrist-Coder/search_api_library/blob/main/README.md
|
|
11
|
-
Keywords: search-api,email-search,phone-search,domain-search,people-search,api-client,balance-management
|
|
11
|
+
Keywords: search-api,email-search,phone-search,domain-search,people-search,api-client,balance-management
|
|
12
12
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -28,7 +28,6 @@ License-File: LICENSE
|
|
|
28
28
|
Requires-Dist: requests>=2.31.0
|
|
29
29
|
Requires-Dist: phonenumbers>=8.13.0
|
|
30
30
|
Requires-Dist: python-dateutil>=2.8.2
|
|
31
|
-
Requires-Dist: cachetools>=5.3.0
|
|
32
31
|
Requires-Dist: typing-extensions>=4.7.0
|
|
33
32
|
Requires-Dist: urllib3>=2.0.0
|
|
34
33
|
Provides-Extra: dev
|
|
@@ -62,7 +61,6 @@ A comprehensive Python client library for the Search API with enhanced error han
|
|
|
62
61
|
- **Enhanced Balance Management**: Manual balance checking capabilities
|
|
63
62
|
- **Access Logs Integration**: Retrieve and analyze API access logs
|
|
64
63
|
- **Improved Error Handling**: Comprehensive exception hierarchy with detailed error messages
|
|
65
|
-
- **Advanced Caching**: Configurable response caching with TTL
|
|
66
64
|
- **Better Data Models**: Enhanced data structures with metadata and cost tracking
|
|
67
65
|
- **Context Manager Support**: Automatic resource cleanup
|
|
68
66
|
- **Comprehensive Validation**: Input validation for all search types
|
|
@@ -95,8 +93,8 @@ try:
|
|
|
95
93
|
|
|
96
94
|
result = client.search_email(
|
|
97
95
|
"example@domain.com",
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
house_value=True,
|
|
97
|
+
extra_info=True
|
|
100
98
|
)
|
|
101
99
|
|
|
102
100
|
print(f"Name: {result.person.name if result.person else 'N/A'}")
|
|
@@ -121,9 +119,6 @@ from search_api import SearchAPI, SearchAPIConfig
|
|
|
121
119
|
config = SearchAPIConfig(
|
|
122
120
|
api_key="your_api_key",
|
|
123
121
|
debug_mode=True, # Enable debug logging
|
|
124
|
-
enable_caching=True, # Enable response caching
|
|
125
|
-
cache_ttl=1800, # 30 minutes cache
|
|
126
|
-
max_cache_size=500, # Maximum cache entries
|
|
127
122
|
timeout=120, # 2 minutes timeout
|
|
128
123
|
max_retries=5, # Retry failed requests
|
|
129
124
|
proxy={ # Optional proxy
|
|
@@ -150,7 +145,7 @@ try:
|
|
|
150
145
|
# Calculate required credits based on actual search costs
|
|
151
146
|
email_search_cost = 0.0025
|
|
152
147
|
phone_search_cost = 0.0025
|
|
153
|
-
domain_search_cost =
|
|
148
|
+
domain_search_cost = 0.0025
|
|
154
149
|
|
|
155
150
|
required_credits = 5 * email_search_cost
|
|
156
151
|
if balance.current_balance < required_credits:
|
|
@@ -169,11 +164,13 @@ except InsufficientBalanceError as e:
|
|
|
169
164
|
### Search Costs:
|
|
170
165
|
- **Email Search**: $0.0025 per search
|
|
171
166
|
- **Phone Search**: $0.0025 per search
|
|
172
|
-
- **Domain Search**: $
|
|
167
|
+
- **Domain Search**: $0.0025 per search
|
|
173
168
|
|
|
174
169
|
### Optional Parameters:
|
|
175
|
-
- **House Value**: Additional $0.
|
|
176
|
-
- **Extra Info**: Additional $0.
|
|
170
|
+
- **House Value (Zestimate)**: Additional $0.0015 per successful lookup
|
|
171
|
+
- **Extra Info**: Additional $0.0015 per successful lookup
|
|
172
|
+
- **Carrier Info**: Additional $0.0005 per successful lookup
|
|
173
|
+
- **TLO Enrichment**: Additional $0.0030 per successful lookup
|
|
177
174
|
|
|
178
175
|
## 📊 Access Logs
|
|
179
176
|
|
|
@@ -214,8 +211,10 @@ print(f"Most active IP: {most_active_ip[0]} ({most_active_ip[1]} accesses)")
|
|
|
214
211
|
```python
|
|
215
212
|
result = client.search_email(
|
|
216
213
|
"john.doe@example.com",
|
|
217
|
-
|
|
218
|
-
|
|
214
|
+
house_value=True,
|
|
215
|
+
extra_info=True,
|
|
216
|
+
carrier_info=True,
|
|
217
|
+
tlo_enrichment=True,
|
|
219
218
|
phone_format="international" # or "national", "e164"
|
|
220
219
|
)
|
|
221
220
|
|
|
@@ -224,6 +223,16 @@ print(f"Valid: {result.email_valid}")
|
|
|
224
223
|
print(f"Type: {result.email_type}")
|
|
225
224
|
print(f"Search Cost: ${result.search_cost}")
|
|
226
225
|
|
|
226
|
+
# Access detailed pricing breakdown
|
|
227
|
+
if result.pricing:
|
|
228
|
+
print(f"Pricing Breakdown:")
|
|
229
|
+
print(f" Base Search: ${result.pricing.search_cost:.4f}")
|
|
230
|
+
print(f" Extra Info: ${result.pricing.extra_info_cost:.4f}")
|
|
231
|
+
print(f" Zestimate: ${result.pricing.zestimate_cost:.4f}")
|
|
232
|
+
print(f" Carrier: ${result.pricing.carrier_cost:.4f}")
|
|
233
|
+
print(f" TLO Enrichment: ${result.pricing.tlo_enrichment_cost:.4f}")
|
|
234
|
+
print(f" Total Cost: ${result.pricing.total_cost:.4f}")
|
|
235
|
+
|
|
227
236
|
if result.person:
|
|
228
237
|
print(f"Name: {result.person.name}")
|
|
229
238
|
print(f"DOB: {result.person.dob}")
|
|
@@ -243,8 +252,10 @@ for phone in result.phone_numbers:
|
|
|
243
252
|
```python
|
|
244
253
|
results = client.search_phone(
|
|
245
254
|
"+1234567890",
|
|
246
|
-
|
|
247
|
-
|
|
255
|
+
house_value=True,
|
|
256
|
+
extra_info=True,
|
|
257
|
+
carrier_info=True,
|
|
258
|
+
tlo_enrichment=True,
|
|
248
259
|
phone_format="international"
|
|
249
260
|
)
|
|
250
261
|
|
|
@@ -252,6 +263,11 @@ for result in results:
|
|
|
252
263
|
print(f"Phone: {result.phone.number}")
|
|
253
264
|
print(f"Search Cost: ${result.search_cost}")
|
|
254
265
|
|
|
266
|
+
# Access detailed pricing breakdown
|
|
267
|
+
if result.pricing:
|
|
268
|
+
print(f" Total Cost: ${result.pricing.total_cost:.4f}")
|
|
269
|
+
print(f" Breakdown: {result.pricing}")
|
|
270
|
+
|
|
255
271
|
if result.person:
|
|
256
272
|
print(f"Name: {result.person.name}")
|
|
257
273
|
print(f"DOB: {result.person.dob}")
|
|
@@ -269,6 +285,10 @@ print(f"Valid: {result.domain_valid}")
|
|
|
269
285
|
print(f"Total results: {result.total_results}")
|
|
270
286
|
print(f"Search Cost: ${result.search_cost}")
|
|
271
287
|
|
|
288
|
+
# Access detailed pricing breakdown
|
|
289
|
+
if result.pricing:
|
|
290
|
+
print(f"Pricing: {result.pricing}")
|
|
291
|
+
|
|
272
292
|
for email_result in result.results:
|
|
273
293
|
print(f"Email: {email_result.email}")
|
|
274
294
|
print(f"Valid: {email_result.email_valid}")
|
|
@@ -316,29 +336,6 @@ except SearchAPIError as e:
|
|
|
316
336
|
print(f"API error: {e}")
|
|
317
337
|
```
|
|
318
338
|
|
|
319
|
-
## 🔄 Caching
|
|
320
|
-
|
|
321
|
-
The client supports configurable response caching:
|
|
322
|
-
|
|
323
|
-
```python
|
|
324
|
-
# Enable caching with custom settings
|
|
325
|
-
config = SearchAPIConfig(
|
|
326
|
-
api_key="your_api_key",
|
|
327
|
-
enable_caching=True,
|
|
328
|
-
cache_ttl=3600, # 1 hour
|
|
329
|
-
max_cache_size=1000 # Maximum 1000 cached responses
|
|
330
|
-
)
|
|
331
|
-
|
|
332
|
-
client = SearchAPI(config=config)
|
|
333
|
-
|
|
334
|
-
# Cache is automatically used for repeated searches
|
|
335
|
-
result1 = client.search_email("test@example.com") # Cached
|
|
336
|
-
result2 = client.search_email("test@example.com") # From cache
|
|
337
|
-
|
|
338
|
-
# Clear cache when needed
|
|
339
|
-
client.clear_cache()
|
|
340
|
-
```
|
|
341
|
-
|
|
342
339
|
## 🧹 Context Manager
|
|
343
340
|
|
|
344
341
|
Use the client as a context manager for automatic resource cleanup:
|
|
@@ -426,12 +423,9 @@ class AccessLog:
|
|
|
426
423
|
|-----------|------|---------|-------------|
|
|
427
424
|
| `api_key` | str | Required | Your API key |
|
|
428
425
|
| `base_url` | str | `"https://search-api.dev/search.php"` | API base URL |
|
|
429
|
-
| `max_retries` | int | `
|
|
426
|
+
| `max_retries` | int | `1` | Maximum retry attempts |
|
|
430
427
|
| `timeout` | int | `90` | Request timeout in seconds |
|
|
431
428
|
| `debug_mode` | bool | `False` | Enable debug logging |
|
|
432
|
-
| `enable_caching` | bool | `True` | Enable response caching |
|
|
433
|
-
| `cache_ttl` | int | `3600` | Cache time-to-live in seconds |
|
|
434
|
-
| `max_cache_size` | int | `1000` | Maximum cache entries |
|
|
435
429
|
| `proxy` | Dict | `None` | Proxy configuration |
|
|
436
430
|
| `user_agent` | str | Chrome UA | Custom user agent |
|
|
437
431
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AD-SearchAPI
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: A comprehensive Python client library for the Search API with enhanced error handling and balance management
|
|
5
5
|
Home-page: https://github.com/AntiChrist-Coder/search_api_library
|
|
6
6
|
Author: Search API Team
|
|
@@ -8,7 +8,7 @@ Author-email: support@search-api.dev
|
|
|
8
8
|
Project-URL: Bug Reports, https://github.com/AntiChrist-Coder/search_api_library/issues
|
|
9
9
|
Project-URL: Source, https://github.com/AntiChrist-Coder/search_api_library
|
|
10
10
|
Project-URL: Documentation, https://github.com/AntiChrist-Coder/search_api_library/blob/main/README.md
|
|
11
|
-
Keywords: search-api,email-search,phone-search,domain-search,people-search,api-client,balance-management
|
|
11
|
+
Keywords: search-api,email-search,phone-search,domain-search,people-search,api-client,balance-management
|
|
12
12
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -28,7 +28,6 @@ License-File: LICENSE
|
|
|
28
28
|
Requires-Dist: requests>=2.31.0
|
|
29
29
|
Requires-Dist: phonenumbers>=8.13.0
|
|
30
30
|
Requires-Dist: python-dateutil>=2.8.2
|
|
31
|
-
Requires-Dist: cachetools>=5.3.0
|
|
32
31
|
Requires-Dist: typing-extensions>=4.7.0
|
|
33
32
|
Requires-Dist: urllib3>=2.0.0
|
|
34
33
|
Provides-Extra: dev
|
|
@@ -62,7 +61,6 @@ A comprehensive Python client library for the Search API with enhanced error han
|
|
|
62
61
|
- **Enhanced Balance Management**: Manual balance checking capabilities
|
|
63
62
|
- **Access Logs Integration**: Retrieve and analyze API access logs
|
|
64
63
|
- **Improved Error Handling**: Comprehensive exception hierarchy with detailed error messages
|
|
65
|
-
- **Advanced Caching**: Configurable response caching with TTL
|
|
66
64
|
- **Better Data Models**: Enhanced data structures with metadata and cost tracking
|
|
67
65
|
- **Context Manager Support**: Automatic resource cleanup
|
|
68
66
|
- **Comprehensive Validation**: Input validation for all search types
|
|
@@ -95,8 +93,8 @@ try:
|
|
|
95
93
|
|
|
96
94
|
result = client.search_email(
|
|
97
95
|
"example@domain.com",
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
house_value=True,
|
|
97
|
+
extra_info=True
|
|
100
98
|
)
|
|
101
99
|
|
|
102
100
|
print(f"Name: {result.person.name if result.person else 'N/A'}")
|
|
@@ -121,9 +119,6 @@ from search_api import SearchAPI, SearchAPIConfig
|
|
|
121
119
|
config = SearchAPIConfig(
|
|
122
120
|
api_key="your_api_key",
|
|
123
121
|
debug_mode=True, # Enable debug logging
|
|
124
|
-
enable_caching=True, # Enable response caching
|
|
125
|
-
cache_ttl=1800, # 30 minutes cache
|
|
126
|
-
max_cache_size=500, # Maximum cache entries
|
|
127
122
|
timeout=120, # 2 minutes timeout
|
|
128
123
|
max_retries=5, # Retry failed requests
|
|
129
124
|
proxy={ # Optional proxy
|
|
@@ -150,7 +145,7 @@ try:
|
|
|
150
145
|
# Calculate required credits based on actual search costs
|
|
151
146
|
email_search_cost = 0.0025
|
|
152
147
|
phone_search_cost = 0.0025
|
|
153
|
-
domain_search_cost =
|
|
148
|
+
domain_search_cost = 0.0025
|
|
154
149
|
|
|
155
150
|
required_credits = 5 * email_search_cost
|
|
156
151
|
if balance.current_balance < required_credits:
|
|
@@ -169,11 +164,13 @@ except InsufficientBalanceError as e:
|
|
|
169
164
|
### Search Costs:
|
|
170
165
|
- **Email Search**: $0.0025 per search
|
|
171
166
|
- **Phone Search**: $0.0025 per search
|
|
172
|
-
- **Domain Search**: $
|
|
167
|
+
- **Domain Search**: $0.0025 per search
|
|
173
168
|
|
|
174
169
|
### Optional Parameters:
|
|
175
|
-
- **House Value**: Additional $0.
|
|
176
|
-
- **Extra Info**: Additional $0.
|
|
170
|
+
- **House Value (Zestimate)**: Additional $0.0015 per successful lookup
|
|
171
|
+
- **Extra Info**: Additional $0.0015 per successful lookup
|
|
172
|
+
- **Carrier Info**: Additional $0.0005 per successful lookup
|
|
173
|
+
- **TLO Enrichment**: Additional $0.0030 per successful lookup
|
|
177
174
|
|
|
178
175
|
## 📊 Access Logs
|
|
179
176
|
|
|
@@ -214,8 +211,10 @@ print(f"Most active IP: {most_active_ip[0]} ({most_active_ip[1]} accesses)")
|
|
|
214
211
|
```python
|
|
215
212
|
result = client.search_email(
|
|
216
213
|
"john.doe@example.com",
|
|
217
|
-
|
|
218
|
-
|
|
214
|
+
house_value=True,
|
|
215
|
+
extra_info=True,
|
|
216
|
+
carrier_info=True,
|
|
217
|
+
tlo_enrichment=True,
|
|
219
218
|
phone_format="international" # or "national", "e164"
|
|
220
219
|
)
|
|
221
220
|
|
|
@@ -224,6 +223,16 @@ print(f"Valid: {result.email_valid}")
|
|
|
224
223
|
print(f"Type: {result.email_type}")
|
|
225
224
|
print(f"Search Cost: ${result.search_cost}")
|
|
226
225
|
|
|
226
|
+
# Access detailed pricing breakdown
|
|
227
|
+
if result.pricing:
|
|
228
|
+
print(f"Pricing Breakdown:")
|
|
229
|
+
print(f" Base Search: ${result.pricing.search_cost:.4f}")
|
|
230
|
+
print(f" Extra Info: ${result.pricing.extra_info_cost:.4f}")
|
|
231
|
+
print(f" Zestimate: ${result.pricing.zestimate_cost:.4f}")
|
|
232
|
+
print(f" Carrier: ${result.pricing.carrier_cost:.4f}")
|
|
233
|
+
print(f" TLO Enrichment: ${result.pricing.tlo_enrichment_cost:.4f}")
|
|
234
|
+
print(f" Total Cost: ${result.pricing.total_cost:.4f}")
|
|
235
|
+
|
|
227
236
|
if result.person:
|
|
228
237
|
print(f"Name: {result.person.name}")
|
|
229
238
|
print(f"DOB: {result.person.dob}")
|
|
@@ -243,8 +252,10 @@ for phone in result.phone_numbers:
|
|
|
243
252
|
```python
|
|
244
253
|
results = client.search_phone(
|
|
245
254
|
"+1234567890",
|
|
246
|
-
|
|
247
|
-
|
|
255
|
+
house_value=True,
|
|
256
|
+
extra_info=True,
|
|
257
|
+
carrier_info=True,
|
|
258
|
+
tlo_enrichment=True,
|
|
248
259
|
phone_format="international"
|
|
249
260
|
)
|
|
250
261
|
|
|
@@ -252,6 +263,11 @@ for result in results:
|
|
|
252
263
|
print(f"Phone: {result.phone.number}")
|
|
253
264
|
print(f"Search Cost: ${result.search_cost}")
|
|
254
265
|
|
|
266
|
+
# Access detailed pricing breakdown
|
|
267
|
+
if result.pricing:
|
|
268
|
+
print(f" Total Cost: ${result.pricing.total_cost:.4f}")
|
|
269
|
+
print(f" Breakdown: {result.pricing}")
|
|
270
|
+
|
|
255
271
|
if result.person:
|
|
256
272
|
print(f"Name: {result.person.name}")
|
|
257
273
|
print(f"DOB: {result.person.dob}")
|
|
@@ -269,6 +285,10 @@ print(f"Valid: {result.domain_valid}")
|
|
|
269
285
|
print(f"Total results: {result.total_results}")
|
|
270
286
|
print(f"Search Cost: ${result.search_cost}")
|
|
271
287
|
|
|
288
|
+
# Access detailed pricing breakdown
|
|
289
|
+
if result.pricing:
|
|
290
|
+
print(f"Pricing: {result.pricing}")
|
|
291
|
+
|
|
272
292
|
for email_result in result.results:
|
|
273
293
|
print(f"Email: {email_result.email}")
|
|
274
294
|
print(f"Valid: {email_result.email_valid}")
|
|
@@ -316,29 +336,6 @@ except SearchAPIError as e:
|
|
|
316
336
|
print(f"API error: {e}")
|
|
317
337
|
```
|
|
318
338
|
|
|
319
|
-
## 🔄 Caching
|
|
320
|
-
|
|
321
|
-
The client supports configurable response caching:
|
|
322
|
-
|
|
323
|
-
```python
|
|
324
|
-
# Enable caching with custom settings
|
|
325
|
-
config = SearchAPIConfig(
|
|
326
|
-
api_key="your_api_key",
|
|
327
|
-
enable_caching=True,
|
|
328
|
-
cache_ttl=3600, # 1 hour
|
|
329
|
-
max_cache_size=1000 # Maximum 1000 cached responses
|
|
330
|
-
)
|
|
331
|
-
|
|
332
|
-
client = SearchAPI(config=config)
|
|
333
|
-
|
|
334
|
-
# Cache is automatically used for repeated searches
|
|
335
|
-
result1 = client.search_email("test@example.com") # Cached
|
|
336
|
-
result2 = client.search_email("test@example.com") # From cache
|
|
337
|
-
|
|
338
|
-
# Clear cache when needed
|
|
339
|
-
client.clear_cache()
|
|
340
|
-
```
|
|
341
|
-
|
|
342
339
|
## 🧹 Context Manager
|
|
343
340
|
|
|
344
341
|
Use the client as a context manager for automatic resource cleanup:
|
|
@@ -426,12 +423,9 @@ class AccessLog:
|
|
|
426
423
|
|-----------|------|---------|-------------|
|
|
427
424
|
| `api_key` | str | Required | Your API key |
|
|
428
425
|
| `base_url` | str | `"https://search-api.dev/search.php"` | API base URL |
|
|
429
|
-
| `max_retries` | int | `
|
|
426
|
+
| `max_retries` | int | `1` | Maximum retry attempts |
|
|
430
427
|
| `timeout` | int | `90` | Request timeout in seconds |
|
|
431
428
|
| `debug_mode` | bool | `False` | Enable debug logging |
|
|
432
|
-
| `enable_caching` | bool | `True` | Enable response caching |
|
|
433
|
-
| `cache_ttl` | int | `3600` | Cache time-to-live in seconds |
|
|
434
|
-
| `max_cache_size` | int | `1000` | Maximum cache entries |
|
|
435
429
|
| `proxy` | Dict | `None` | Proxy configuration |
|
|
436
430
|
| `user_agent` | str | Chrome UA | Custom user agent |
|
|
437
431
|
|
|
@@ -7,7 +7,6 @@ A comprehensive Python client library for the Search API with enhanced error han
|
|
|
7
7
|
- **Enhanced Balance Management**: Manual balance checking capabilities
|
|
8
8
|
- **Access Logs Integration**: Retrieve and analyze API access logs
|
|
9
9
|
- **Improved Error Handling**: Comprehensive exception hierarchy with detailed error messages
|
|
10
|
-
- **Advanced Caching**: Configurable response caching with TTL
|
|
11
10
|
- **Better Data Models**: Enhanced data structures with metadata and cost tracking
|
|
12
11
|
- **Context Manager Support**: Automatic resource cleanup
|
|
13
12
|
- **Comprehensive Validation**: Input validation for all search types
|
|
@@ -40,8 +39,8 @@ try:
|
|
|
40
39
|
|
|
41
40
|
result = client.search_email(
|
|
42
41
|
"example@domain.com",
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
house_value=True,
|
|
43
|
+
extra_info=True
|
|
45
44
|
)
|
|
46
45
|
|
|
47
46
|
print(f"Name: {result.person.name if result.person else 'N/A'}")
|
|
@@ -66,9 +65,6 @@ from search_api import SearchAPI, SearchAPIConfig
|
|
|
66
65
|
config = SearchAPIConfig(
|
|
67
66
|
api_key="your_api_key",
|
|
68
67
|
debug_mode=True, # Enable debug logging
|
|
69
|
-
enable_caching=True, # Enable response caching
|
|
70
|
-
cache_ttl=1800, # 30 minutes cache
|
|
71
|
-
max_cache_size=500, # Maximum cache entries
|
|
72
68
|
timeout=120, # 2 minutes timeout
|
|
73
69
|
max_retries=5, # Retry failed requests
|
|
74
70
|
proxy={ # Optional proxy
|
|
@@ -95,7 +91,7 @@ try:
|
|
|
95
91
|
# Calculate required credits based on actual search costs
|
|
96
92
|
email_search_cost = 0.0025
|
|
97
93
|
phone_search_cost = 0.0025
|
|
98
|
-
domain_search_cost =
|
|
94
|
+
domain_search_cost = 0.0025
|
|
99
95
|
|
|
100
96
|
required_credits = 5 * email_search_cost
|
|
101
97
|
if balance.current_balance < required_credits:
|
|
@@ -114,11 +110,13 @@ except InsufficientBalanceError as e:
|
|
|
114
110
|
### Search Costs:
|
|
115
111
|
- **Email Search**: $0.0025 per search
|
|
116
112
|
- **Phone Search**: $0.0025 per search
|
|
117
|
-
- **Domain Search**: $
|
|
113
|
+
- **Domain Search**: $0.0025 per search
|
|
118
114
|
|
|
119
115
|
### Optional Parameters:
|
|
120
|
-
- **House Value**: Additional $0.
|
|
121
|
-
- **Extra Info**: Additional $0.
|
|
116
|
+
- **House Value (Zestimate)**: Additional $0.0015 per successful lookup
|
|
117
|
+
- **Extra Info**: Additional $0.0015 per successful lookup
|
|
118
|
+
- **Carrier Info**: Additional $0.0005 per successful lookup
|
|
119
|
+
- **TLO Enrichment**: Additional $0.0030 per successful lookup
|
|
122
120
|
|
|
123
121
|
## 📊 Access Logs
|
|
124
122
|
|
|
@@ -159,8 +157,10 @@ print(f"Most active IP: {most_active_ip[0]} ({most_active_ip[1]} accesses)")
|
|
|
159
157
|
```python
|
|
160
158
|
result = client.search_email(
|
|
161
159
|
"john.doe@example.com",
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
house_value=True,
|
|
161
|
+
extra_info=True,
|
|
162
|
+
carrier_info=True,
|
|
163
|
+
tlo_enrichment=True,
|
|
164
164
|
phone_format="international" # or "national", "e164"
|
|
165
165
|
)
|
|
166
166
|
|
|
@@ -169,6 +169,16 @@ print(f"Valid: {result.email_valid}")
|
|
|
169
169
|
print(f"Type: {result.email_type}")
|
|
170
170
|
print(f"Search Cost: ${result.search_cost}")
|
|
171
171
|
|
|
172
|
+
# Access detailed pricing breakdown
|
|
173
|
+
if result.pricing:
|
|
174
|
+
print(f"Pricing Breakdown:")
|
|
175
|
+
print(f" Base Search: ${result.pricing.search_cost:.4f}")
|
|
176
|
+
print(f" Extra Info: ${result.pricing.extra_info_cost:.4f}")
|
|
177
|
+
print(f" Zestimate: ${result.pricing.zestimate_cost:.4f}")
|
|
178
|
+
print(f" Carrier: ${result.pricing.carrier_cost:.4f}")
|
|
179
|
+
print(f" TLO Enrichment: ${result.pricing.tlo_enrichment_cost:.4f}")
|
|
180
|
+
print(f" Total Cost: ${result.pricing.total_cost:.4f}")
|
|
181
|
+
|
|
172
182
|
if result.person:
|
|
173
183
|
print(f"Name: {result.person.name}")
|
|
174
184
|
print(f"DOB: {result.person.dob}")
|
|
@@ -188,8 +198,10 @@ for phone in result.phone_numbers:
|
|
|
188
198
|
```python
|
|
189
199
|
results = client.search_phone(
|
|
190
200
|
"+1234567890",
|
|
191
|
-
|
|
192
|
-
|
|
201
|
+
house_value=True,
|
|
202
|
+
extra_info=True,
|
|
203
|
+
carrier_info=True,
|
|
204
|
+
tlo_enrichment=True,
|
|
193
205
|
phone_format="international"
|
|
194
206
|
)
|
|
195
207
|
|
|
@@ -197,6 +209,11 @@ for result in results:
|
|
|
197
209
|
print(f"Phone: {result.phone.number}")
|
|
198
210
|
print(f"Search Cost: ${result.search_cost}")
|
|
199
211
|
|
|
212
|
+
# Access detailed pricing breakdown
|
|
213
|
+
if result.pricing:
|
|
214
|
+
print(f" Total Cost: ${result.pricing.total_cost:.4f}")
|
|
215
|
+
print(f" Breakdown: {result.pricing}")
|
|
216
|
+
|
|
200
217
|
if result.person:
|
|
201
218
|
print(f"Name: {result.person.name}")
|
|
202
219
|
print(f"DOB: {result.person.dob}")
|
|
@@ -214,6 +231,10 @@ print(f"Valid: {result.domain_valid}")
|
|
|
214
231
|
print(f"Total results: {result.total_results}")
|
|
215
232
|
print(f"Search Cost: ${result.search_cost}")
|
|
216
233
|
|
|
234
|
+
# Access detailed pricing breakdown
|
|
235
|
+
if result.pricing:
|
|
236
|
+
print(f"Pricing: {result.pricing}")
|
|
237
|
+
|
|
217
238
|
for email_result in result.results:
|
|
218
239
|
print(f"Email: {email_result.email}")
|
|
219
240
|
print(f"Valid: {email_result.email_valid}")
|
|
@@ -261,29 +282,6 @@ except SearchAPIError as e:
|
|
|
261
282
|
print(f"API error: {e}")
|
|
262
283
|
```
|
|
263
284
|
|
|
264
|
-
## 🔄 Caching
|
|
265
|
-
|
|
266
|
-
The client supports configurable response caching:
|
|
267
|
-
|
|
268
|
-
```python
|
|
269
|
-
# Enable caching with custom settings
|
|
270
|
-
config = SearchAPIConfig(
|
|
271
|
-
api_key="your_api_key",
|
|
272
|
-
enable_caching=True,
|
|
273
|
-
cache_ttl=3600, # 1 hour
|
|
274
|
-
max_cache_size=1000 # Maximum 1000 cached responses
|
|
275
|
-
)
|
|
276
|
-
|
|
277
|
-
client = SearchAPI(config=config)
|
|
278
|
-
|
|
279
|
-
# Cache is automatically used for repeated searches
|
|
280
|
-
result1 = client.search_email("test@example.com") # Cached
|
|
281
|
-
result2 = client.search_email("test@example.com") # From cache
|
|
282
|
-
|
|
283
|
-
# Clear cache when needed
|
|
284
|
-
client.clear_cache()
|
|
285
|
-
```
|
|
286
|
-
|
|
287
285
|
## 🧹 Context Manager
|
|
288
286
|
|
|
289
287
|
Use the client as a context manager for automatic resource cleanup:
|
|
@@ -371,12 +369,9 @@ class AccessLog:
|
|
|
371
369
|
|-----------|------|---------|-------------|
|
|
372
370
|
| `api_key` | str | Required | Your API key |
|
|
373
371
|
| `base_url` | str | `"https://search-api.dev/search.php"` | API base URL |
|
|
374
|
-
| `max_retries` | int | `
|
|
372
|
+
| `max_retries` | int | `1` | Maximum retry attempts |
|
|
375
373
|
| `timeout` | int | `90` | Request timeout in seconds |
|
|
376
374
|
| `debug_mode` | bool | `False` | Enable debug logging |
|
|
377
|
-
| `enable_caching` | bool | `True` | Enable response caching |
|
|
378
|
-
| `cache_ttl` | int | `3600` | Cache time-to-live in seconds |
|
|
379
|
-
| `max_cache_size` | int | `1000` | Maximum cache entries |
|
|
380
375
|
| `proxy` | Dict | `None` | Proxy configuration |
|
|
381
376
|
| `user_agent` | str | Chrome UA | Custom user agent |
|
|
382
377
|
|