Registry / communication / neverbounce-sdk

neverbounce-sdk

JSON →
library4.3.0pypypi✓ verified 84d ago

The official Python SDK for the NeverBounce API (version 4) provides a streamlined interface for email verification. It supports both single email checks and bulk list processing, aiming to improve email deliverability and sender reputation. The library is actively maintained, with the current version being 4.3.0, and includes bug fixes and documentation updates.

pip install neverbounce_sdk
INSTALL
IMPORT
SIG · NEVERBOUNCE-SDK
N
neverbounce-sdk
communicationpythonv4.3.0
Install
2.1s avg
Import
595ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.630s · 21.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.1s · import 0.561s · 22MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

client
import neverbounce_sdk client = neverbounce_sdk.client(...)
from neverbounce import NeverBounce
The official SDK uses `neverbounce_sdk.client`. `from neverbounce import NeverBounce` refers to an older, unofficial wrapper that may not be compatible with the V4 API.

Initialize the NeverBounce client with your V4 API key, then perform common operations like fetching account information or verifying a single email address. Ensure your API key is prefixed with `secret_`.

import neverbounce_sdk import os # It's recommended to store your API key in an environment variable api_key = os.environ.get('NEVERBOUNCE_API_KEY', 'secret_YOUR_API_KEY_HERE') if not api_key.startswith('secret_') or 'YOUR_API_KEY_HERE' in api_key: print("Warning: Please replace 'secret_YOUR_API_KEY_HERE' with your actual NeverBounce V4 API key or set the NEVERBOUNCE_API_KEY environment variable.") print("You can generate a V4 API key at: https://app.neverbounce.com/apps/custom-integration/new") else: try: client = neverbounce_sdk.client(api_key=api_key, timeout=30) # Get account info info = client.account_info() print(f"Account Info: {info}") # Verify a single email test_email = 'test@example.com' resp = client.single_check(test_email) print(f"Verification for {test_email}: Result = {resp['result']}, Execution Time = {resp['execution_time']}ms") except neverbounce_sdk.auth_failure as e: print(f"Authentication Error: {e}. Check your API key.") except neverbounce_sdk.nb_error as e: print(f"NeverBounce API Error: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingNeverBounce V3 API keys (8-character username or 12-16 character secret key) are incompatible with the V4 API. Using a V3 key with this SDK will result in an `auth_failure` error.
fix
Generate a new V4 API key from the NeverBounce dashboard, which will start with `secret_`.
affects: All versions (since V4 API launch)
gotchaHandling 'Accept All' (catch-all) email addresses requires careful consideration. NeverBounce identifies these as 'unverifiable' because the domain is configured to accept all emails, making definitive validation impossible. Sending to these emails can still lead to high bounce rates if your email provider requires a low bounce rate (e.g., below 4%).
fix
Review the `result` codes, specifically `accept_all` (numeric code 3), and adjust your sending strategy based on your email provider's bounce rate tolerance and your dedicated email server setup.
affects: All versions
deprecatedAlthough version 4.2.6 included a fix for Python 2.7, Python 2.7 is End-of-Life (EOL). While the SDK might still function, it's strongly recommended to use Python 3.6 or higher for security and ongoing support.
fix
Migrate your application to Python 3.6 or a newer supported Python version.
affects: <= 4.3.0
gotchaExposing your NeverBounce API key in client-side code (e.g., JavaScript in a web browser) is a security risk. The Python SDK is intended for server-side use.
fix
Always use the NeverBounce API key on your backend servers. For client-side verification, use the official NeverBounce JavaScript Widget, which handles API key security.
affects: All versions
Errors
Common errors & fixes
neverbounce_sdk.auth_failure: Invalid API Key. Please provide a valid NeverBounce V4 API Key.
Attempting to authenticate with a NeverBounce V3 API key (old format) or an invalid V4 API key.
fix
Ensure you are using a NeverBounce V4 API key, which begins with `secret_`. Generate a new key from your NeverBounce account if needed.
ImportError: No module named neverbounce_sdk
The `neverbounce-sdk` package is not installed or the import path is incorrect (e.g., trying `import neverbounce` instead of `import neverbounce_sdk`).
fix
Install the package using `pip install neverbounce_sdk` and ensure your import statement is `import neverbounce_sdk`.
requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer')) or requests.exceptions.Timeout
Network connectivity issues, firewall blocking the connection, or the NeverBounce API endpoint timing out. The SDK defaults to a 30-second timeout.
fix
Check your internet connection, firewall settings, and ensure the NeverBounce API is reachable. You can also adjust the `timeout` parameter when initializing the client (e.g., `client = neverbounce_sdk.client(api_key=api_key, timeout=60)` for a longer timeout).
KeyError: 'result' (when accessing `resp['result']`)
The API response structure was unexpected, possibly due to an API error that didn't raise a `neverbounce_sdk.nb_error`, or an empty/malformed response.
fix
Implement robust error handling around API calls. Check for `neverbounce_sdk.nb_error` exceptions and inspect the raw response object if available to debug the actual API response content in case of unexpected keys.
Upgrade
Version history
4.3.0latest on PyPI · released Aug 5, 2020
Audit
Dependencies
requestsrequiredHandles HTTP requests to the NeverBounce API.
sixrequiredProvides Python 2 and 3 compatibility utilities.
Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
neverbounce-sdk — pip install neverbounce-sdk · libregistry