Skip to main content

This is the backport to python 2.7 of the official python wrapper for the Emailable API.

Project description

Emailable Python Library Backport

License Python versions Version

This is the backport to Python 2.7 of the Emailable's official python wrapper for the Emailable API.

Documentation

See the Python API docs.

Installation

pip install emailable-backport

Usage

The library needs to be configured with your account's API key which is available in your Emailable Dashboard.

Setup

import emailable

client = emailable.Client('live_...')

Verification

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

# additional parameters are available. see API docs for additional 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, callback_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:

poetry run tox

Contributing

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

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

emailable-backport-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

emailable_backport-1.0.0-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file emailable-backport-1.0.0.tar.gz.

File metadata

  • Download URL: emailable-backport-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/2.7.17 Linux/5.4.0-73-generic

File hashes

Hashes for emailable-backport-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c0fa49892c2c271039bd63e0b27e09a5496e962202de3fc870aaa2e76661faf1
MD5 82c5ca449f739609d0df666896567018
BLAKE2b-256 6f79840fc01cec201dc1ebcbdbe80b9d6d91788061e3e855e2a0916c5a143607

See more details on using hashes here.

File details

Details for the file emailable_backport-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: emailable_backport-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/2.7.17 Linux/5.4.0-73-generic

File hashes

Hashes for emailable_backport-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2903c427553de5284d3ccd4b7d2b71d9592f67eef679cece21884fe4a9fc0177
MD5 a70d71627f61d70e2aef0e9b7eeb0da0
BLAKE2b-256 b44402571ea2663bd086d1b9943f0d13b2bc7b4fa38f98cdd9eac3eaa8becaac

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