# Path: bidwire/notifiers/notifier_utils.py
# def send_email(subject, mail_body, recipients):
#     log.info("Sending email to recipients {}".format(recipients))
#     sg = sendgrid.SendGridAPIClient(apikey=bidwire_settings.SENDGRID_API_KEY)
#     from_email = Email(bidwire_settings.ADMIN_EMAIL)
#     content = Content("text/html", mail_body)
#     for recipient in recipients:
#         to_email = Email(recipient)
#         mail = Mail(from_email, subject, to_email, content)
#         response = sg.client.mail.send.post(request_body=mail.get())
#         log.info("Sendgrid response status: {}".format(response.status_code))
# 
# def make_html_body(items, func_format_item, pre_list_text=None):
#     """Returns an HTML email body listing all new items.
# 
#     The produced HTML looks like:
#     <pre_list_text>
#     <list of new items, generated calling func_format_item>
#     <post_list_text>
# 
#     Arguments:
#     items -- a list of new items to put in the email (can be any type)
#     func_format_item -- a function that takes one item and returns an
#         HTML-formatted version of this item
#     pre_list_text -- any text to put before the item list
#     post_list_text -- any text to put after the item list
# 
#     Returns:
#     the resulting HTML, as a string
#     """
#     doc, tag, text = Doc().tagtext()
#     if pre_list_text:
#         with tag('p'):
#             text(pre_list_text)
#     with tag('ul'):
#         for item in items:
#             with tag('li'):
#                 # Append the HTML for the item to the doc as-is (don't escape)
#                 doc.asis(func_format_item(item))
#     return doc.getvalue()


import logging
import os
import sendgrid
import bidwire_settings
from sendgrid.helpers.mail import *
from yattag import Doc
from .notifier_utils import send_email, make_html_body



log = logging.getLogger(__name__)


class BaseNotifier:
    def __init__(self):
        self.site_name = self.get_site().value

    # TODO(anaulin): Remove this method, and replace it with setting the
    # site_name in each constructor.

# Path: bidwire/notifiers/notifier_utils.py
# def send_email(subject, mail_body, recipients):
#     log.info("Sending email to recipients {}".format(recipients))
#     sg = sendgrid.SendGridAPIClient(apikey=bidwire_settings.SENDGRID_API_KEY)
#     from_email = Email(bidwire_settings.ADMIN_EMAIL)
#     content = Content("text/html", mail_body)
#     for recipient in recipients:
#         to_email = Email(recipient)
#         mail = Mail(from_email, subject, to_email, content)
#         response = sg.client.mail.send.post(request_body=mail.get())
#         log.info("Sendgrid response status: {}".format(response.status_code))
# 
# def make_html_body(items, func_format_item, pre_list_text=None):
#     """Returns an HTML email body listing all new items.
# 
#     The produced HTML looks like:
#     <pre_list_text>
#     <list of new items, generated calling func_format_item>
#     <post_list_text>
# 
#     Arguments:
#     items -- a list of new items to put in the email (can be any type)
#     func_format_item -- a function that takes one item and returns an
#         HTML-formatted version of this item
#     pre_list_text -- any text to put before the item list
#     post_list_text -- any text to put after the item list
# 
#     Returns:
#     the resulting HTML, as a string
#     """
#     doc, tag, text = Doc().tagtext()
#     if pre_list_text:
#         with tag('p'):
#             text(pre_list_text)
#     with tag('ul'):
#         for item in items:
#             with tag('li'):
#                 # Append the HTML for the item to the doc as-is (don't escape)
#                 doc.asis(func_format_item(item))
#     return doc.getvalue()


# Path: bidwire/notifiers/base_notifier.py
import logging
import os
import sendgrid
import bidwire_settings
from sendgrid.helpers.mail import *
from yattag import Doc
from .notifier_utils import send_email, make_html_body




log = logging.getLogger(__name__)


class BaseNotifier:
    def __init__(self):
        self.site_name = self.get_site().value

    # TODO(anaulin): Remove this method, and replace it with setting the
    # site_name in each constructor.

    def get_site(self):