This is the official python wrapper for the Emailable API.
Maintained. Last release 7 days ago, commits in 7 of the last 26 weeks. Weaker on release cadence and contributor spread.
pip install emailableEmailable Python Library
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')
Timeouts
By default, the client waits up to 30 seconds to connect and up to 60 seconds
for the server to send data before raising emailable.ClientError. The read
timeout applies to each wait between bytes, not to the whole response. Both
must be positive numbers of seconds. To change them for every client:
emailable.Client.open_timeout = 10
emailable.Client.read_timeout = 45
The read timeout is separate from the timeout argument to verify, which
tells the API how long to spend verifying before returning a 249 response.
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.