mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Mailgun: fix webhook error with null delivery-status
Mailgun now sometimes posts `"delivery-status": null` in the tracking event payload. Avoid raising an AttributeError when that occurs. Fixes #361
This commit is contained in:
@@ -172,12 +172,12 @@ class MailgunTrackingWebhookView(MailgunBaseWebhookView):
|
||||
|
||||
try:
|
||||
delivery_status = event_data["delivery-status"]
|
||||
except KeyError:
|
||||
description = None
|
||||
mta_response = None
|
||||
else:
|
||||
# if delivery_status is None, an AttributeError will be raised
|
||||
description = delivery_status.get("description")
|
||||
mta_response = delivery_status.get("message")
|
||||
except (KeyError, AttributeError):
|
||||
description = None
|
||||
mta_response = None
|
||||
|
||||
if "reason" in event_data:
|
||||
reject_reason = self.reject_reasons.get(
|
||||
|
||||
Reference in New Issue
Block a user