mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
install: remove need to name [esp]
Simplify install to just `pip install django-anymail`. (Rather than `... django-anymail[mailgun]` All of the ESPs so far require requests, so just move that into the base requirements. (Chances are your Django app already needs requests for some other reason, anyway.) Truly unique ESP dependencies (e.g., boto for AWS-SES) could still use the setup extra features mechanism.
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
import json
|
||||
|
||||
import requests
|
||||
# noinspection PyUnresolvedReferences
|
||||
from six.moves.urllib.parse import urljoin
|
||||
|
||||
from .base import AnymailBaseBackend, BasePayload
|
||||
from ..exceptions import AnymailImproperlyInstalled, AnymailRequestsAPIError, AnymailSerializationError
|
||||
from ..exceptions import AnymailRequestsAPIError, AnymailSerializationError
|
||||
from .._version import __version__
|
||||
|
||||
try:
|
||||
# noinspection PyUnresolvedReferences
|
||||
import requests
|
||||
except ImportError:
|
||||
raise AnymailImproperlyInstalled('requests')
|
||||
|
||||
|
||||
class AnymailRequestsBackend(AnymailBaseBackend):
|
||||
"""
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.mail import make_msgid
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
|
||||
from ..exceptions import AnymailImproperlyInstalled, AnymailRequestsAPIError
|
||||
from ..exceptions import AnymailRequestsAPIError
|
||||
from ..message import AnymailRecipientStatus
|
||||
from ..utils import get_anymail_setting, timestamp
|
||||
|
||||
from .base_requests import AnymailRequestsBackend, RequestsPayload
|
||||
|
||||
try:
|
||||
# noinspection PyUnresolvedReferences
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
except ImportError:
|
||||
raise AnymailImproperlyInstalled('requests', backend="sendgrid")
|
||||
|
||||
|
||||
class SendGridBackend(AnymailRequestsBackend):
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import json
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
try:
|
||||
from requests import HTTPError
|
||||
except ImportError:
|
||||
# Backends that don't use requests aren't required to have it installed
|
||||
# (and could never raise an AnymailRequestsAPIError)
|
||||
class HTTPError(Exception):
|
||||
pass
|
||||
from requests import HTTPError
|
||||
|
||||
|
||||
class AnymailError(Exception):
|
||||
|
||||
Reference in New Issue
Block a user