Skip to content

Instantly share code, notes, and snippets.

@saevarom
Created June 27, 2012 11:24
Show Gist options
  • Save saevarom/3003464 to your computer and use it in GitHub Desktop.
Save saevarom/3003464 to your computer and use it in GitHub Desktop.
Update mailchimp list by django group
from django.conf import settings
from mailsnake import MailSnake
ms = MailSnake(settings.MAILCHIMP_API_KEY)
from django.contrib.auth.models import Group
group_name = 'group-name'
list_id = 'list-id'
group = Group.objects.get(name=group_name)
for user in group.user_set.all():
result = ms.listSubscribe(id=list_id, email_address=user.email, update_existing=True, double_optin=False)
print user, result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment