Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

480 overnight error adding email to mailchimp list #469

Merged
merged 2 commits into from
Nov 1, 2018

Conversation

benvand
Copy link
Contributor

@benvand benvand commented Oct 18, 2018

If we get a 'User already subscribed' 400 error from mailchimp then return True from the subscribe_new_email_to_list method to avoid raising a 503 in the supplier frontend
https://github.com/alphagov/digitalmarketplace-supplier-frontend/blob/master/app/main/views/suppliers.py#L770

Traceback:

Traceback (most recent call last):
  File "/app/venv/lib/python3.6/site-packages/dmutils/timing.py", line 79, in logged_duration
    yield log_context
  File "/app/venv/lib/python3.6/site-packages/dmutils/email/dm_mailchimp.py", line 112, in subscribe_new_email_to_list
    "status_if_new": "subscribed"
  File "/app/venv/lib/python3.6/site-packages/mailchimp3/entities/listmembers.py", line 163, in create_or_update
    return self._mc_client._put(url=self._build_path(list_id, 'members', subscriber_hash), data=data)
  File "/app/venv/lib/python3.6/site-packages/mailchimp3/mailchimpclient.py", line 25, in wrapper
    return fn(self, *args, **kwargs)
  File "/app/venv/lib/python3.6/site-packages/mailchimp3/mailchimpclient.py", line 158, in _put
    r.raise_for_status()
  File "/app/venv/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://us5.api.mailchimp.com/3.0/lists/7534b3e89a/members/a3003c67999a823fd80398b3c2b0d4ee

Bring this in to supplier Crown-Commercial-Service/digitalmarketplace-supplier-frontend#939

Copy link
Contributor

@katstevens katstevens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small typo to fix 👍

@@ -113,31 +113,32 @@ def subscribe_new_email_to_list(self, list_id, email_address):
}
)
except RequestException as e:
# Some errors we don't care about but do want to log. Find and log them here.q
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A rogue q has sneaked in here

@benvand benvand force-pushed the 480-overnight-error-adding-email-to-mailchimp-list branch from 16af7ae to 8f21353 Compare October 29, 2018 11:15
@benvand benvand merged commit 60de048 into master Nov 1, 2018
@benvand benvand deleted the 480-overnight-error-adding-email-to-mailchimp-list branch November 1, 2018 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants