Skip to main content

A python client for v3 of MailChimp API

Project description

|mailchimp3 v1.0.24 on PyPi| |MIT license| |Stable|

python-mailchimp-api
====================

A straighforward python client for v3 of MailChimp API using requests >=
2.7.0.

Getting Started
---------------

Installation
~~~~~~~~~~~~

This client is hosted at PyPi under the name ``mailchimp3``, to install
it, simply run

``pip install mailchimp3``

Initialization
~~~~~~~~~~~~~~

Grab ``YOUR SECRET KEY`` from your mailchimp account (Account > Extra >
Api Keys). ``YOUR USERNAME`` is the one you use to login.

::

from mailchimp3 import MailChimp

client = MailChimp('YOUR USERNAME', 'YOUR SECRET KEY')

Examples
~~~~~~~~

::

# returns all the lists (only name and id)
client.list.all(fields="lists.name,lists.id")

# returns all members inside list '123456'
client.member.all('123456')

# same query, but with query params
client.member.all('123456', count=100, offset=0, fields="members.email_address")

# returns the list matching id '123456'
client.list.get('123456')

# add John Doe with email john.doe@example.com to list matching id '123456'
client.member.create('123456', {
'email_address': 'john.doe@example.com',
'status': 'subscribed',
'merge_fields': {
'FNAME': 'John',
'LNAME': 'Doe',
},
})

# returns all the campaigns
client.campaign.all()

# You can also disable at runtime with the optional ``enabled`` parameter.
# Every API call will return None
client = MailChimp('YOUR USERNAME', 'YOUR SECRET KEY', enabled=False)

Pagination
~~~~~~~~~~

Simply add ``count`` and ``offset`` arguments in your function like so:

::

client.member.all('123456', count=100, offset=0)

Fields
~~~~~~

Simply add ``fields`` arguments in your function. The following only
display email\_address and id for each member:

::

client.member.all('123456', fields="members.email_address,members.id")

API
---

Authorized Apps
~~~~~~~~~~~~~~~

::

client.authorizedapp.all()
client.authorizedapp.get(app_id='')

Automation
~~~~~~~~~~

Automation
^^^^^^^^^^

::

client.automation.all()
client.automation.get(workflow_id='')
client.automation.pause(workflow_id='')
client.automation.start(workflow_id='')

Automation Email
^^^^^^^^^^^^^^^^

::

client.automationemail.all(workflow_id='')
client.automationemail.get(workflow_id='', email_id='')
client.automationemail.pause(workflow_id='', email_id='')
client.automationemail.start(workflow_id='', email_id='')

Automation Email Queue
^^^^^^^^^^^^^^^^^^^^^^

::

client.automationemailqueue.all(workflow_id='', email_id='')
client.automationemailqueue.get(workflow_id='', email_id='', member_id='')
client.automationemailqueue.create(workflow_id='', email_id='', data='')

Automation Removed Subscribers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

client.automationeremovedsubscriber.all(workflow_id='')
client.automationeremovedsubscriber.create(workflow_id='', data='')

Campaign
~~~~~~~~

Campaign
^^^^^^^^

::

client.campaign.all()
client.campaign.create(data={})
client.campaign.get(campaign_id='')
client.campaign.delete(campaign_id='')
client.campaign.patch(campaign_id='', data={})
client.campaign.cancel(campaign_id='')
client.campaign.get_content(campaign_id='', \*\*queryparams)
client.campaign.set_content(campaign_id='', data={})

Campaigns feedback
^^^^^^^^^^^^^^^^^^

::

client.feedback.all(campaign_id='')
client.feedback.create(campaign_id='', data={})
client.feedback.get(campaign_id='', feedback_id='')
client.feedback.update(campaign_id='', feedback_id='', data={})
client.feedback.delete(campaign_id='', feedback_id='')

Conversations
~~~~~~~~~~~~~

::

client.conversation.all()
client.conversation.get(conversation_id='')

Files
~~~~~

::

client.file.all()
client.file.create(data='')

Interest
~~~~~~~~

::

client.interest.all(list_id, category_id, count=100)
client.interest.create(list_id, category_id, post_data)
client.interest.get(list_id, category_id, interest_id)
client.interest.update(list_id, category_id, interest_id, post_data)
client.interest.delete(list_id, category_id, interest_id)

Lists
~~~~~

::

client.list.all()
client.list.get(list_id='')
client.list.create(data='')
client.list.update(list_id='', data='')
client.list.delete(list_id='')

Members
~~~~~~~

::

client.member.all(list_id='', \*\*queryparams)

Reports
~~~~~~~

::

client.report.all()
client.report.get(report_id='')

Templates
~~~~~~~~~

::

client.template.all()
client.template.get(template_id='')
client.template.update(template_id='', data='')
client.template.delete(template_id='')

Root
~~~~

::

client.root.get()

Support
-------

If you are having issues, please let us know.

License
-------

The project is licensed under the MIT License.

.. |mailchimp3 v1.0.17 on PyPi| image:: https://img.shields.io/badge/pypi-1.0.17-green.svg
:target: https://pypi.python.org/pypi/mailchimp3
.. |MIT license| image:: https://img.shields.io/badge/licence-MIT-blue.svg
.. |Stable| image:: https://img.shields.io/badge/status-stable-green.svg

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

mailchimp3-1.0.25-py2.py3-none-any.whl (23.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mailchimp3-1.0.25-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for mailchimp3-1.0.25-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1f1cb627640d3e8282f32baeed15afcebbf8297013ba84ac8ecedfdff7ca3391
MD5 e2ae29cbb583aa95f22e153e29cf93dc
BLAKE2b-256 57876f63b7d9c2469bed25d2cc522ff4ad0f85f8026562e744fac8290c5a4c1a

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