2023-12-29 18:11:55 -05:00
|
|
|
from abc import abstractmethod, abstractproperty
|
|
|
|
|
|
2021-03-10 13:55:06 +00:00
|
|
|
from app.clients import Client, ClientException
|
2016-02-17 17:48:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class EmailClientException(ClientException):
|
2023-08-29 14:54:30 -07:00
|
|
|
"""
|
2016-02-17 17:48:23 +00:00
|
|
|
Base Exception for EmailClients
|
2023-08-29 14:54:30 -07:00
|
|
|
"""
|
|
|
|
|
|
2016-02-17 17:48:23 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
2020-12-30 17:06:49 +00:00
|
|
|
class EmailClientNonRetryableException(ClientException):
|
2023-08-29 14:54:30 -07:00
|
|
|
"""
|
2020-12-30 17:06:49 +00:00
|
|
|
Represents an error returned from the email client API with a 4xx response code
|
|
|
|
|
that should not be retried and should instead be marked as technical failure.
|
|
|
|
|
An example of this would be an email address that makes it through our
|
|
|
|
|
validation rules but is rejected by SES. There is no point in retrying this type as
|
|
|
|
|
it will always fail however many calls to SES. Whereas a throttling error would not
|
|
|
|
|
use this exception as it may succeed if we retry
|
2023-08-29 14:54:30 -07:00
|
|
|
"""
|
|
|
|
|
|
2020-12-30 17:06:49 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
2016-02-17 17:48:23 +00:00
|
|
|
class EmailClient(Client):
|
2023-08-29 14:54:30 -07:00
|
|
|
"""
|
2016-02-17 17:48:23 +00:00
|
|
|
Base Email client for sending emails.
|
2023-08-29 14:54:30 -07:00
|
|
|
"""
|
2016-02-17 17:48:23 +00:00
|
|
|
|
2023-12-29 18:11:55 -05:00
|
|
|
@abstractmethod
|
2016-02-17 17:48:23 +00:00
|
|
|
def send_email(self, *args, **kwargs):
|
2023-08-29 14:54:30 -07:00
|
|
|
raise NotImplementedError("TODO Need to implement.")
|
2016-02-25 11:23:04 +00:00
|
|
|
|
2023-12-29 18:11:55 -05:00
|
|
|
@abstractproperty
|
2022-03-24 17:31:53 +00:00
|
|
|
def name(self):
|
2023-08-29 14:54:30 -07:00
|
|
|
raise NotImplementedError("TODO Need to implement.")
|