Created
June 27, 2012 11:24
-
-
Save saevarom/3003464 to your computer and use it in GitHub Desktop.
Update mailchimp list by django group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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