mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Cleanup: simplify requests backend raise_for_status
Treat all 2xx (not just 200) as success in base AnymailRequestsBackend.raise_for_status, eliminating some unnecessary subclass overrides.
This commit is contained in:
@@ -5,7 +5,7 @@ from email.utils import quote as rfc822_quote
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
|
||||
from .base_requests import AnymailRequestsBackend, RequestsPayload
|
||||
from ..exceptions import AnymailConfigurationError, AnymailRequestsAPIError, AnymailWarning
|
||||
from ..exceptions import AnymailConfigurationError, AnymailWarning
|
||||
from ..message import AnymailRecipientStatus
|
||||
from ..utils import BASIC_NUMERIC_TYPES, Mapping, get_anymail_setting, update_deep
|
||||
|
||||
@@ -52,11 +52,6 @@ class EmailBackend(AnymailRequestsBackend):
|
||||
def build_message_payload(self, message, defaults):
|
||||
return SendGridPayload(message, defaults, self)
|
||||
|
||||
def raise_for_status(self, response, payload, message):
|
||||
if response.status_code < 200 or response.status_code >= 300:
|
||||
raise AnymailRequestsAPIError(email_message=message, payload=payload, response=response,
|
||||
backend=self)
|
||||
|
||||
def parse_recipient_status(self, response, payload, message):
|
||||
# If we get here, the send call was successful.
|
||||
# (SendGrid uses a non-2xx response for any failures, caught in raise_for_status.)
|
||||
|
||||
Reference in New Issue
Block a user