Skip to content
Updated & maintained MailChimp API v1.3 wrapper for Python
Find file
Pull request Compare This branch is 2 commits ahead, 46 commits behind michaelhelmick:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


MailSnake is a Python wrapper for MailChimp's The API, STS API, Export API, and the new Mandrill API.


pip install mailsnake


from mailsnake import MailSnake
from mailsnake.exceptions import *

try: # returns "Everything's Chimpy!"
except MailSnakeException:
    print 'An error occurred. :('

You can also catch specific errors:

ms = MailSnake('my_wrong_mailchimp_api_key_that_does_not_exist')
try: # returns "Everything's Chimpy!"
except InvalidApiKeyException:
    print 'You have a bad API key, sorry.'

The default API is MCAPI, but STS, Export, and Mandrill can be used by supplying an api argument set to 'sts', 'export', or 'mandrill' respectively. Here's an example:

mcsts = MailSnake('YOUR MAILCHIMP API KEY', api='sts')
mcsts.GetSendQuota() # returns something like {'Max24HourSend': '10000.0', 'SentLast24Hours': '0.0', 'MaxSendRate': '5.0'}

Since the Mandrill API is divided into sections, one must take that into account when using it. Here's an example:

mapi = MailSnake('YOUR MANDRILL API KEY', api='mandrill') # returns 'PONG!'


mapi_users = MailSnake('YOUR MANDRILL API KEY', api='mandrill', api_section='users') # returns 'PONG!'

Some Mandrill functions have a dash(-) in the name. Since Python function names can't have dashes in them, use underscores(_) instead:

mapi = MailSnake('YOUR MANDRILL API KEY', api='mandrill')
mapi.messages.send(message={'html':'email html', 'subject':'email subject', 'from_email':'', 'from_name':'From Name', 'to':[{'email':'', 'name':'To Name'}]}) # returns 'PONG!'


API parameters must be passed by name. For example:

mcapi.listMemberInfo(id='YOUR LIST ID', email_address='')

API Documentation

Note that in order to use the STS API or Mandrill you first need to enable the Amazon Simple Email Service or the Mandrill integration in MailChimp.

MailChimp API v1.3 documentation

MailChimp STS API v1.0 documentation

MailChimp Export API v1.0 documentation

Something went wrong with that request. Please try again.