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:
@@ -87,9 +87,10 @@ class AnymailRequestsBackend(AnymailBaseBackend):
|
||||
(though should defer parsing/deserialization of the body to
|
||||
parse_recipient_status)
|
||||
"""
|
||||
if response.status_code != 200:
|
||||
raise AnymailRequestsAPIError(email_message=message, payload=payload, response=response,
|
||||
backend=self)
|
||||
if response.status_code < 200 or response.status_code >= 300:
|
||||
raise AnymailRequestsAPIError(
|
||||
email_message=message, payload=payload,
|
||||
response=response, backend=self)
|
||||
|
||||
def deserialize_json_response(self, response, payload, message):
|
||||
"""Deserialize an ESP API response that's in json.
|
||||
|
||||
Reference in New Issue
Block a user