From 859fae2c82a1aeefbc3e690be081daefb5fbd1e9 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 6 Sep 2018 14:59:48 +0200 Subject: [PATCH 1/1] ignore mailchimp errors --- contact/mailing.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/contact/mailing.py b/contact/mailing.py index bfd4209..fc40a10 100644 --- a/contact/mailing.py +++ b/contact/mailing.py @@ -41,12 +41,15 @@ def subscribe(email): else: if member['status'] != 'subscribed': remove_from_groups(email, client) - client.lists.members.create_or_update( - settings.MAILCHIMP_LIST_ID, subscriber_hash(email), - data={ - 'email_address': email, - 'status_if_new': 'subscribed', - 'status': 'subscribed', - 'interests': INTERESTS, - } - ) + try: + client.lists.members.create_or_update( + settings.MAILCHIMP_LIST_ID, subscriber_hash(email), + data={ + 'email_address': email, + 'status_if_new': 'subscribed', + 'status': 'subscribed', + 'interests': INTERESTS, + } + ) + except MailChimpError: + pass -- 2.20.1