Skip to main content

Emailable Python Library

Version Build Status Maintainability

This is the official python wrapper for the Emailable API.

Documentation

See the Python API docs.

Installation

pip install emailable

Usage

Authentication

The Emailable API requires either an API key or an access token for authentication. API keys can be created and managed in the Emailable Dashboard.

An API key can be set globally for the Emailable client:

client = emailable.Client('your_api_key')

Or, you can specify an api_key or an access_token with each request:

# set api_key at request time
client.verify(api_key='your_api_key')

# set access_token at request time
client.verify(access_token='your_access_token')

Verification

# verify an email address
response = client.verify('evan@emailable.com')
response.state
=> 'deliverable'

# additional parameters are available. see API docs for more info.
client.verify('evan@emailable.com', smtp=False, accept_all=True, timeout=25)

Slow Email Server Handling

Some email servers are slow to respond. As a result, the timeout may be reached before we are able to complete the verification process. If this happens, the verification will continue in the background on our servers. We recommend sleeping for at least one second and trying your request again. Re-requesting the same verification with the same options will not impact your credit allocation within a 5 minute window.

A slow response will return with a 249 status code.

response = client.verify('slow@example.com')
response.status_code
=> 249
response.message
=> 'Your request is taking longer than normal. Please send your request again.'

Batch Verification

Start a batch

emails = ['evan@emailable.com', 'support@emailable.com', ...]
response = client.batch(emails)
response.id
=> '5cff27400000000000000000'

# you can optionally pass in a callback url that we'll POST to when the
# batch is complete.
response = client.batch(emails, {'url': 'https://emailable.com/'})

Get the status / results of a batch

To get the status of a batch call batch_status with the batch's id. If your batch is still being processed, you will receive a message along with the current progress of the batch. When a batch is completed, you can access the results in the emails attribute.

response = client.batch_status('5cff27400000000000000000')

# if your batch is still running
response.processed
=> 1
response.total
=> 2
response.message
=> 'Your batch is being processed.'

# if your batch is complete
response.emails
=> [{'email': 'evan@emailable.com', 'state': 'deliverable'...}, {'email': 'support@emailable.com', 'state': 'deliverable'...}...]

# get the counts
response.total_counts
=>{'deliverable': 2, 'undeliverable': 0 ...}
response.reason_counts
=>{'accepted_email': 2, 'rejected_email': 0 ...}

Development

Tests can be run with the following command:

pytest

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/emailable/emailable-python.

Metadata

Release files for emailable 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emailable 3.1.0
File Size Uploaded
emailable-3.1.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for emailable 3.1.0
File Interpreter ABI Platform
emailable-3.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / emailable-3.1.0.tar.gz

Download URL emailable-3.1.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e32d1d1f74bb1f4f3a90cc97e9b4ae17dfd0bca5151b4f7f1335a5faa945a1dd
BLAKE2b-256 checksum
How to use checksums
7dbec4ec495319905e13bd10d8c5c73f573c65bb3c39c116779e2e614168b029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Release files / emailable-3.1.0-py3-none-any.whl

Download URL emailable-3.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2dbacf2d2664a459c1eb5648b6cf4275aa9910e5ccd23880b07c9b4b86038c6c
BLAKE2b-256 checksum
How to use checksums
354df503de6d13034497294e21f9934add82704b561ea9b52372df94b4068423
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

3.1.0 This release

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page