How to use the pyisemail.EmailValidator function in pyIsEmail

To help you get started, we’ve selected a few pyIsEmail examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github michaelherold / pyIsEmail / tests / test_email_validator.py View on Github external
def test_abstract_is_email(self):
        v = EmailValidator()

        self.assertRaises(NotImplementedError, v.is_email, "test@example.com")
github michaelherold / pyIsEmail / pyisemail / validators / parser_validator.py View on Github external
"""Transforms the ASCII control character symbols to their real char.

    Note: If the token is not an ASCII control character symbol, just
    return the token.

    Keyword arguments:
    token -- the token to transform

    """
    if ord(token) in _range(9216, 9229 + 1):
        token = _unichr(ord(token) - 9216)

    return token


class ParserValidator(EmailValidator):
    def is_email(self, address, diagnose=False):
        """Check that an address address conforms to RFCs 5321, 5322 and others.

        More specifically, see the follow RFCs:
            * http://tools.ietf.org/html/rfc5321
            * http://tools.ietf.org/html/rfc5322
            * http://tools.ietf.org/html/rfc4291#section-2.2
            * http://tools.ietf.org/html/rfc1123#section-2.1
            * http://tools.ietf.org/html/rfc3696) (guidance only)

        Keyword arguments:
        address    -- address to check.
        diagnose   -- flag to report a diagnosis or a boolean (default False)

        """