MailSnake
is a Python wrapper for MailChimp API 1.3 (as well as the STS API, Export API, and Mandrill API) (Now with support for Python 3)
pip install mailsnake
from mailsnake import MailSnake from mailsnake.exceptions import * ms = MailSnake('YOUR MAILCHIMP API KEY') try: ms.ping() # returns "Everything's Chimpy!" except MailSnakeException: print 'An error occurred. :('
mapi = MailSnake('YOUR MANDRILL API KEY', api='mandrill') mapi.users.ping() # returns "PONG!"
mcsts = MailSnake('YOUR MAILCHIMP API KEY', api='sts') mcsts.GetSendQuota() # returns something like {'Max24HourSend': '10000.0', 'SentLast24Hours': '0.0', 'MaxSendRate': '5.0'}
ms = MailSnake( 'my_wrong_mailchimp_api_key_that_does_not_exist') try: ms.ping() # returns "Everything's Chimpy!" except InvalidApiKeyException: print 'You have a bad API key, sorry.'
API parameters must be passed by name. For example:
ms.listMemberInfo(id='YOUR LIST ID', email_address='[email protected]')