Official repository of the Pepipost SDK for Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pepipost
CONTRIBUTING.md
LICENSE
README.md
requirements.txt
setup.py

README.md

pepipostlogo

MIT licensed Open Source Helpers Twitter Follow

Official Python library 🐍 for Pepipost

This SDK contain methods for easily interacting with the Pepipost Email Sending API to send emails within few seconds.

We are trying to make our libraries a Community Driven. To help us building right things in proper order we would request you to help us by sharing comments, creating new issues or pull requests. We welcome any sort of contribution to this library.

The latest 2.5.0 version of this library provides is fully compatible with the latest Pepipost v2.0 API. For any update of this library check Releases

Table of Content

Installation

There are two ways of installing this Pepipost library. You can use either of the below:

pip install pepipost

Once Pepipost is install, use the sample example to test.

OR

git clone https://github.com/pepipost/pepipost-sdk-python.git pepipost_python

Prerequisites

  • Python (2 >=2.7.9 or 3 >= 3.4)

  • Python IDE (we are using Pycharm )

  • Python packages

    • nose
    • jsonpickle
    • requests
    • cachecontrol
    • python-dateutil
  • Installation of PIP can be done from here.

  • We recommend using PIP Dependency manager in order to install all the dependencies which we had mentioned in requirements.txt files that comes in SDK.

Defining environment variable

  • Python and PIP should be defined in your PATH. Verify the same using below commands:

    pip --version //This will display the version of PIP dependency manager installed.

    python --version //This will display the version of Python installed. This should be >=2.7.1, if you are using Python 2 else it can be >=3.4 if you are using Python 3.

  • Use the below command to navigate to the directory:

    cd pepipost_python

Quickstart- Using the SDK from GitHub repository

  1. Run the below command to download the requirements:

    pip install -r requirements.txt

    Building SDK - Step 1

  2. Open project in an IDE. Here we have used PyCharm IDE. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.

    Open project in PyCharm - Step 1

    Click on Open in PyCharm to browse to your generated SDK directory and then

    Click OK

    Open project in PyCharm - Step 2

    The project files will be displayed in the side bar as follows:

    Open project in PyCharm - Step 3

  3. Add a new "Test Project"

    Create a new directory by right clicking on the solution name as shown below:

    Add a new project in PyCharm - Step 1

    Name the directory as "test"

    Add a new project in PyCharm - Step 2

    Add a python file to this project with the name "testsdk"

    Add a new project in PyCharm - Step 3

    Name it "testsdk"

    Add a new project in PyCharm - Step 4

  4. Importing files from python library

    In order to import file you need to just copy the sample file from here.

    Add a new project in PyCharm - Step 4

  5. Get your API key and Sending Domain from your Pepipost account.

    • apikey will be available under Login to Pepipost -> Settings -> Integration
    • Sending Domain will be available under Login to Pepiost -> Settings -> Sending Domains
  *Note :: Domains showing with Active status on Sending Domain dashboard are only allowed to send any sort of emails.* In case there are no Sending Domain added under your account, then first add the domain, get the DNS (SPF/DKIM) settings done and get it reviewed by our compliance team for approval. Once the domain is approved, it will be in ACTIVE status and will be ready to send any sort of emails. 
  1. Run the Test Project

    Ctrl+F5

    OR

    Right click on your Python file inside your Test project and click on Run

    Run Test Project - Step 1

Sample Example

from pepipost.pepipost_client import PepipostClient
from pepipost.models.email_body import EmailBody
from pepipost.models.personalizations import Personalizations
from pepipost.models.attachments import Attachments
from pepipost.models.mfrom import From
from pepipost.models.email_body_attachments import EmailBodyAttachments
from pepipost.models.settings import Settings
from pepipost.exceptions.api_exception import APIException
import jsonpickle

client = PepipostClient()
email_controller = client.email
body = EmailBody()
body.personalizations = []

api_key = 'api_key here '
body.personalizations.append(Personalizations())
body.personalizations[0].recipient = 'recipient@your-mail.com'

body.tags = 'tagsPython'
body.mfrom = From()

body.mfrom.from_email = 'example@your-verified-domain'
body.mfrom.from_name = 'Example Pepi'
body.subject = 'Emailing with Pepipost is easy'
body.content = '<html><body>Hey,<br><br>Do you know integration is even simpler in Pepipost, <br>with Python <br> Happy Mailing ! <br><br>Pepipost </body></html>'
body.settings = Settings()

body.settings.footer = 1
body.settings.clicktrack = 1
body.settings.opentrack = 1
body.settings.unsubscribe = 1

try:
    result = email_controller.create_send_email(api_key, body)
    if not (result.error_info.error_message is None):
        print("Reason :: " + str(result.error_info.error_message) + "\n" + "Message :: " + str(result.message))
    else:
        print("Message :: " + result.message)
except APIException as e:
    print(e)

Announcements

v2.5.0 has been released! Please see the release notes for details.

All updates to this library are documented in our releases. For any queries, feel free to reach out us at dx@pepipost.com

Roadmap

If you are interested in the future direction of this project, please take a look at our open issues and pull requests. We would love to hear your feedback.

About

pepipost-sdk-python library is guided and supported by the Pepipost Developer Experience Team . This pepipost-sdk-python library is maintained and funded by Pepipost Ltd. The names and logos for pepipost-php-sdk are trademarks of Pepipost Ltd.

License

This code library was semi-automatically generated by APIMATIC v2.0 and licensed under The MIT License (MIT).