Python Integration Library

Learn more about how to download and implement our Python API Integration Library to your system.

Overview - what this Library is?

We want to provide our clients a way to use our system however they like. That is why we have introduced the Integration Libraries - a group of functions and declarations to help you implement our API to your system.

How to download and implement the Library

All of our libraries are available here, whereas the specific library for Python can be found at the following link.

After you have downloaded the library (which is a single .py file), you might want to put it in your Python directory to have a quick and easy access to it manually or through your own code.

You will be using the import functionality to access any classes and methods that you need. Here's an example of such import. Insert this line of code at the beginning of your script:

from ElasticEmailClient import ApiClient, Account, Email

How to start working with the Library on your project

Whether you want to send an email or modify your template, you can do so by using the specific class under which the relevant methods can be found. You can refer to the ApiTypes class to create the desired object that would be used as a parameter in some calls.

The responses are being held as the dictionaries. Many of them are the representations of classes that you can find in the ApiTypes class or our API documentation. Use whichever source you like to read the response and use it however you like - print it on the screen or log in your database.

First of all, we need to set up an ApiKey, that is the unique identifier of your account. You can do this in two ways:

First option: open up in your editor. Then, in the ApiClient class, you can find two fields: apiKey and apiUri. Change the former's value to your ApiKey available to you here. Don't mind the apiUri field, it is best to leave it untouched.

Second option: simply overwrite the apiKey field's value of the ApiClient class at the start of your code. Remember to import the ApiClient class first:

from ElasticEmailClient import ApiClient
ApiClient.apiKey = '11111111-2222-3333-4444-555555555555'

This can also be used to swap between the accounts while your program is running, so you can keep this line in mind.


All code samples are licensed under MIT license.

Github Repository

Python Repository

If you like this article, share it with friends:
Share on Facebook
0Tweet about this on Twitter
Share on LinkedIn