Skip to main content

EmailVerify.io Python SDK

Project description

Email Verify Python SDK

This SDK contains methods for interacting easily with Email Verify API. More information about EmailVerify you can find in the official webiste.

Official Python SDK for EmailVerify.io - A comprehensive email verification service.

Features

  • Single Email Validation - Validate individual email addresses
  • 💰 Account Balance Checking - Monitor your credits and API status
  • 📦 Batch Validation - Process up to 5,000 emails at once
  • 🔍 Email Finder - Find email addresses by name and domain

INSTALLATION

pip install emailverifysdk

USAGE

Import the sdk in your file:

from emailverifysdk import EmailVerify

Initialize the sdk with your api key:

email_verify = EmailVerify("<YOUR_API_KEY>")

Examples

Then you can use any of the SDK methods, for example:

  • Check how many credits you have left on your account
from emailverifysdk import EmailVerify, EmailVerifyException

try:
    email_verify = EmailVerify("<YOUR_API_KEY>")
    response = email_verify.check_balance()
    print("Email Verify response: " + str(response))
except EmailVerifyException as e:
    print("EmailVerifyException error: " + str(e))

Sample response:

BalanceResponse = {
    'api_status': 'enabled',
    'daily_credits_limit': 0,
    'referral_credits': 0,
    'remaining_credits': 9986
}

Note: You can access any value of the response using attribute access, e.g. response.api_status

Sample response for appsumo users:

BalanceResponse = {
    'api_status': 'enabled', 
    'daily_credits_limit': 1000, 
    'remaining_daily_credits': 998, 
    'bonus_credits': 35000
}
  • Validate an email address
from emailverifysdk import EmailVerify, EmailVerifyException

try:
    email_verify = EmailVerify("<YOUR_API_KEY>")
    response = email_verify.validate("<EMAIL_ADDRESS>") # EMAIL ADDRESS MUST BE STRING
    print("Email Verify response: " + str(response))
except EmailVerifyException as e:
    print("EmailVerifyException error: " + str(e))

Sample response:

ValidateResponse = {
    'email': '<EMAIL_ADDRESS>', 
    'status': 'do_not_mail', 
    'sub_status': 'mailbox_quota_exceeded'
}

Status can be any of the following:

  • valid
  • invalid
  • catch_all
  • do_not_mail
  • unknown
  • role_based
  • skipped

Sub Status can be any of the following:

  • permitted
  • failed_syntax_check
  • mailbox_quota_exceeded
  • mailbox_not_found
  • no_dns_entries
  • disposable
  • none
  • opt_out
  • blocked_domain
  • Batch Validation
from emailverifysdk import EmailVerify, EmailVerifyException

try:
    email_verify = EmailVerify("<YOUR_API_KEY>")
    emails = ['email1@example.com', 'email2@example.com', 'email3@example.com']
    response = email_verify.validate_batch(emails, "<TITLE>") # title and emails are required fields
    print("Email Verify response: " + str(response))
except EmailVerifyException as e:
    print("EmailVerifyException error: " + str(e))

Sample response:

BatchValidateResponse= {
    'status': 'queued', 
    'task_id': 2922, 
    'count_submitted': 5, 
    'count_duplicates_removed': 0, 
    'count_rejected_emails': 1, 
    'count_processing': 4
}
  • Get Batch Validation Result
from emailverifysdk import EmailVerify, EmailVerifyException

task_id = 1 #TASK_ID must be your task_id received in bulk validation api

try:
    email_verify = EmailVerify("<YOUR_API_KEY>")
    response = email_verify.get_batch_result(task_id) 
    print("Email Verify response: " + str(response))
except EmailVerifyException as e:
    print("EmailVerifyException error: " + str(e))

Sample response when task stil under verification:

BatchResultResponse = {
    'count_checked': 0, 
    'count_total': 4, 
    'name': 'Title', 
    'progress_percentage': 0.0, 
    'task_id': 2922, 
    'status': 'queued',
    'results': None
}

Sample response when verification completed

BatchResultResponse = {
    'count_checked': 4, 
    'count_total': 4, 
    'name': 'Title', 
    'progress_percentage': 100, 
    'task_id': 2922, 
    'status': 'verified', 
    'results': {
        'email_batch': [
            {
                'address': 'email1@example.com', 
                'status': 'do_not_mail', 
                'sub_status': 'mailbox_quota_exceeded'
            }, 
            {   
                'address': 'email2@example.com', 
                'status': 'do_not_mail',
                'sub_status': 'mailbox_quota_exceeded'
            }, 
            {   
                'address': 'email3@example.com', 
                'status': 'do_not_mail', 
                'sub_status': 'mailbox_quota_exceeded'}, 
        ]
    }
}
  • Email Finder
from emailverifysdk import EmailVerify, EmailVerifyException

try:
    email_verify = EmailVerify("<YOUR_API_KEY>")
    response = email_verify.find_email('<NAME>', '<DOMAIN.COM>')
    print("Email Verify response: " + str(response))
except EmailVerifyException as e:
    print("EmailVerifyException error: " + str(e))

Sample response when email found:

FinderResponse = {
    'email': 'email1@example.com', 
    'status': 'found'
}

Sample response when email not found:

FinderResponse = {
    'email': 'null', 
    'status': 'not_found'
}

Exception Handling

The EmailVerify SDK raises custom exceptions for API errors, invalid input, and network issues. You should always wrap SDK calls in a try/except block to handle these cases gracefully.

Common Exceptions

  • EmailVerifyAPIException: Raised for API errors (invalid key, disable key, insufficient credits, invalid paramets etc.)
  • EmailVerifyClientException: Raised for client-side errors (missing parameters, invalid input)
  • EmailVerifyNetworkException: Raised for network connection errors
  • EmailVerifyTimeoutException: Raised when a request times out

Example Usage

from emailverifysdk import EmailVerify, EmailVerifyAPIException, EmailVerifyClientException

email_verify = EmailVerify("<YOUR_API_KEY>")
try:
    response = email_verify.validate("test@example.com")
    print("Validation result:", response.status)
except EmailVerifyAPIException as api_err:
    print("API error:", api_err)
except EmailVerifyClientException as client_err:
    print("Client error:", client_err)
except Exception as e:
    print("Unexpected error:", e)

Accessing Error Details

If an EmailVerifyAPIException is raised, you can access additional details:

from emailverifysdk import EmailVerify, EmailVerifyAPIException

email_verify = EmailVerify("<YOUR_API_KEY>")
try:
    response = email_verify.validate("email@example.com")
except EmailVerifyAPIException as e:
    print("Message", str(e))
    print("Status code:", e.status_code)
    print("Response data:", e.response_data)

Context Manager Usage

from emailverifysdk import EmailVerify

email_verify = EmailVerify("<YOUR_API_KEY>")

with EmailVerify("<YOUR_API_KEY>") as email_verify:
    response = email_verify.validate("test@example.com")
    print(str(response))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emailverifysdk-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emailverifysdk-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file emailverifysdk-0.1.0.tar.gz.

File metadata

  • Download URL: emailverifysdk-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for emailverifysdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c98e8b7d5c6712e8a1516fc565879229556f68804744f358d92b2c5e887dbcc7
MD5 16274d8793e2f0d78bdbe7f49990cd7c
BLAKE2b-256 7bc9cf28a98aec451db28d9edbfb019529631bf401c229fc6bf373310741ca28

See more details on using hashes here.

File details

Details for the file emailverifysdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: emailverifysdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for emailverifysdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bb2bd3c2fbc40363c0d083c4c179b49286f3638c7cf70d5666816b0c262a808
MD5 d90beac41295e332c644577aa80bdbff
BLAKE2b-256 09583731bbdc296e136d4a9c7cb85ac397cc58df6c6ae8721af6fa6da3ea7b84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page