mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-30 05:23:59 +03:00
c50322db02
* Add DependenciesContainer provider * Remove bundles_v2 example * Add use cases example * Update changelog * Update documentation requirements to use fixed version of sphinxcontrib-disqus * Add use cases miniapp to docs * Update changelog
26 lines
645 B
Python
26 lines
645 B
Python
"""Example adapters package."""
|
|
|
|
|
|
class EmailSender(object):
|
|
"""Abstract email sender."""
|
|
|
|
def send(self, to, body):
|
|
"""Send email to specified email."""
|
|
raise NotImplementedError()
|
|
|
|
|
|
class SmtpEmailSender(object):
|
|
"""SMTP email sender uses SMTP protocol for sending emails."""
|
|
|
|
def send(self, to, body):
|
|
"""Send email to specified email."""
|
|
# Send email via SMTP
|
|
|
|
|
|
class EchoEmailSender(object):
|
|
"""Echo email sender prints emails to stdout."""
|
|
|
|
def send(self, to, body):
|
|
"""Send email to specified email."""
|
|
print('Sending email to "{0}", body = "{1}"'.format(to, body))
|