Skip to main content

Python Interface for the Sendy API

Project description

.. |nlshield| image:: https://img.shields.io/badge/100%25-Netlandish-blue.svg?style=square-flat
:target: http://www.netlandish.com

==============================
sendypy |nlshield|
==============================
:Info: Simple module to interface with the Sendy API (https://sendy.co/api)
:Version: 0.1.5b
:Author: Peter Sanchez (http://www.petersanchez.com) - (http://www.netlandish.com)

Dependencies
============

* It was written for Python 2.7+ and Python 3.6+
* Depends on the requests module

**NOTE:**

* **Version 1.3b** adds the new "title" variable to the ``create_campaign`` API call. It effects the default ordering of variables in the call. If you're upgrading from a previous version please ensure that you account for the new ordering of variables. This new variable was added in Sendy v2.1.2.6

Installation
============

PIP::

pip install sendypy

Basic Manual Install::

$ python setup.py build
$ sudo python setup.py install

Alternative Install (Manually):

Place sendy directory in your Python path. Either in your Python installs site-packages directory or set your $PYTHONPATH environment variable to include a directory where the impersonate directory lives.


Use
===
All the variables and response values are described in the `Sendy API docs <https://sendy.co/api>`_

Usage is simple ::

from sendy.api import SendyAPI
api = SendyAPI(host='https://your-sendy-install.com/sendy/', api_key='YOUR_API_KEY')

You don't need to set the api_key variable if you're using the
subscribe or unsubscribe methods. You can also provide the optional
"debug" variable (defaults to False). This will print debug into to
stdout when sending a request to your Sendy install.

**Subscribe** ::

api.subscribe('list_id_here', 'email@address.com', 'optional first name', custom_field_1='value', custom_field_2='value', ...)

*Optional fields*

- `country`: User's 2 letter country code.
- `ipaddress`: User's IP address.
- `referrer`: The URL where the user signed up from.
- `gdpr`: If you're signing up EU users in a GDPR compliant manner.
- `hp`: Include this 'honeypot' field to prevent spambots.

data = {"gdpr": True, "ipaddress": "127.0.0.1", "country": "US"}

api.subscribe(list_id, email, **data)

**Unsubscribe** ::

api.unsubscribe('list_id_here', 'email@address.com')

**Delete** ::

api.delete('list_id_here', 'email@address.com')

**Subscription Status** ::

api.subscription_status('list_id_here', 'email@address.com')

**Subscriber Count** ::

api.subscriber_count('list_id_here')

**Create Campaign** ::

api.create_campaign(
from_name='Your Name',
from_email='Your Sender Email',
reply_to='Your Reply-to Email',
title='Your Email Title',
subject='Your Email Subject',
plain_text='Plain Text Email Body',
html_text='HTML Email Body',
list_ids='list_id_1,list_id_2,list_id_3',
brand_id='your brand id',
query_string='Your query string',
send_campaign=0, #default's to 0, use 1 to send email right away
)


Copyright & Warranty
====================
All documentation, libraries, and sample code are
Copyright 2016 Netlandish Inc., Peter Sanchez <petersanchez@gmail.com>. The library
and sample code are made available to you under the terms of the BSD license
which is contained in the included file, BSD-LICENSE.


==================
Commercial Support
==================

This software, and lots of other software like it, has been built in support of many of
Netlandish's own projects, and the projects of our clients. We would love to help you
on your next project so get in touch by dropping us a note at hello@netlandish.com.


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

sendypy-0.1.5b0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

sendypy-0.1.5b0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file sendypy-0.1.5b0.tar.gz.

File metadata

  • Download URL: sendypy-0.1.5b0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for sendypy-0.1.5b0.tar.gz
Algorithm Hash digest
SHA256 aa8cac3fd69994cf3e81a686e2a034090c4e7a56b54f37caa91df8a15e9726c7
MD5 2773d7bee9ff4ef2638ef51fc6e4668e
BLAKE2b-256 4ade698b7e2d16dcee79c0d29571ef726332639b365c9b537b4e7258b628ed60

See more details on using hashes here.

File details

Details for the file sendypy-0.1.5b0-py3-none-any.whl.

File metadata

  • Download URL: sendypy-0.1.5b0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for sendypy-0.1.5b0-py3-none-any.whl
Algorithm Hash digest
SHA256 acccefba0edf1d6a11fd8652929e0606ccf543ca14e3c0b72072fa56b47f169e
MD5 34c6167bd87f5ea2b13aa905a246d36b
BLAKE2b-256 d21d5b19d30ec9b4df9f659d5e14fd9feecaef8e9135a5d8ff5b93362be5cc6b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page