<commit_before>import requests


class Mailer:
    auth = None
    api_url = None
    sender = None

    def __init__(self, domain, api_key, sender_name):
        self.auth = ("api", api_key)
        self.api_url = "https://api.mailgun.net/v3/%s" % domain
        self.sender = "%s <noreply@%s>" % (sender_name, domain)

    def send_simple_message(self, data):
        data['from'] = self.sender
        return requests.post("%s/messages" % self.api_url, auth=self.auth,
                             data=data)<commit_msg>Documented mailer.py (#49)<commit_after>import requests


class Mailer:
    '''
    Sends a mail through the Mailgun API

    attr auth: contains the Mailgun API key
    type auth: tuple(str, str)
    attr api_url: Base URL of the Mailgun API
    type api_url: str
    attr sender: email address of the sender
    type sender: str
    '''

    auth = None
    api_url = None
    sender = None

    def __init__(self, domain, api_key, sender_name):
        '''
        Constructor for the Mailer class

        :param domain: Domain name of the sender
        :type domain: str
        :param api_key: API key of the Mailgun API
        :type api_key: str
        :param sender_name: name of the person sending the email
        :type sender_name: str
        '''
        self.auth = ("api", api_key)
        self.api_url = "https://api.mailgun.net/v3/%s" % domain
        self.sender = "%s <noreply@%s>" % (sender_name, domain)

    def send_simple_message(self, data):
        '''
        Sends a message 

        :param data: A dict consisting of the data for email
        :type data: dict
        :return: A Response object
        :rtype: requests.Response
        '''
        data['from'] = self.sender
        return requests.post("%s/messages" % self.api_url, auth=self.auth,
                             data=data)
{'fraction_non_alphanumeric': 0.10395235517054684, 'fraction_numerical': 0.002165674066053059, 'mean_word_length': 2.169811320754717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3886879', 'n_tokens_mistral': 565, 'n_tokens_neox': 543, 'n_words': 172}