• File: __init__.py
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/usr/lib/python2.7/site-packages/email_split/__init__.py
  • Date Modified: 02/04/2016 7:11 PM
  • File size: 655 bytes
  • MIME-type: text/x-script.python
  • Charset: utf-8
# Define an email class
class Email(object):
    def __init__(self, local, domain):
        # local is content before `@` in email
        # domain is content after `@` in email
        self.local = local
        self.domain = domain

    @classmethod
    def split_email(cls, email):
        """Break up an email and initialize a new class"""
        # Break up our email at its `@`
        # https://docs.python.org/2/library/stdtypes.html#str.partition
        local, _, domain = email.partition('@')

        # Initialize and return our class
        return Email(local=local, domain=domain)


# Define our main export
email_split = Email.split_email