当前位置: 首页>>代码示例>>Python>>正文


Python email_validator.validate_email方法代码示例

本文整理汇总了Python中email_validator.validate_email方法的典型用法代码示例。如果您正苦于以下问题:Python email_validator.validate_email方法的具体用法?Python email_validator.validate_email怎么用?Python email_validator.validate_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在email_validator的用法示例。


在下文中一共展示了email_validator.validate_email方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import validate_email [as 别名]
def __init__(self, email):
        """Initialize a new Email notification.

        Arguments:
            email: the email to notify. This value is validated a little
                   stricter than other notification values to prevent unwanted
                   behavior when a detector actually fires.
        """
        valid_email = validate_email(email, check_deliverability=False)
        self.options = {'type': 'Email', 'email': valid_email['email']} 
开发者ID:Nike-Inc,项目名称:signal_analog,代码行数:12,代码来源:detectors.py

示例2: is_valid_email_address

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import validate_email [as 别名]
def is_valid_email_address(email_address):
	"""
	Check that the string specified appears to be a valid email address.

	:param str email_address: The email address to validate.
	:return: Whether the email address appears to be valid or not.
	:rtype: bool
	"""
	if email_address is None:
		return False
	try:
		email_validator.validate_email(email_address, allow_empty_local=False, check_deliverability=False)
	except email_validator.EmailNotValidError:
		return False
	return True 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:17,代码来源:utilities.py

示例3: validate_email

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import validate_email [as 别名]
def validate_email(email):
    try:
        return email_validator.validate_email(email)["email"]
    except email_validator.EmailNotValidError as e:
        raise EmailNotValidException(str(e)) 
开发者ID:cgwire,项目名称:zou,代码行数:7,代码来源:auth.py

示例4: validate_email_address

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import validate_email [as 别名]
def validate_email_address(question, value):
        # Run the same checks as text (data type is str, stripped, and is not empty).
        value = validator.validate_text(question, value)

        # Then validate and normalize the value as an email address.
        # When we're running tests, skip DNS-based deliverability checks
        # so that tests can be run in a completely offline mode. Otherwise
        # dns.resolver.NoNameservers will result in EmailUndeliverableError.
        import email_validator
        from django.conf import settings
        info = email_validator.validate_email(value, check_deliverability=settings.VALIDATE_EMAIL_DELIVERABILITY)
        return info["email"] 
开发者ID:GovReady,项目名称:govready-q,代码行数:14,代码来源:answer_validation.py

示例5: validate

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import validate_email [as 别名]
def validate(cls, value: Union[str]) -> str:
        return validate_email(value)[1] 
开发者ID:samuelcolvin,项目名称:pydantic,代码行数:4,代码来源:networks.py

示例6: validate_email

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import validate_email [as 别名]
def validate_email(value: Union[str]) -> Tuple[str, str]:
    """
    Brutally simple email address validation. Note unlike most email address validation
    * raw ip address (literal) domain parts are not allowed.
    * "John Doe <local_part@domain.com>" style "pretty" email addresses are processed
    * the local part check is extremely basic. This raises the possibility of unicode spoofing, but no better
        solution is really possible.
    * spaces are striped from the beginning and end of addresses but no error is raised

    See RFC 5322 but treat it with suspicion, there seems to exist no universally acknowledged test for a valid email!
    """
    if email_validator is None:
        import_email_validator()

    m = pretty_email_regex.fullmatch(value)
    name: Optional[str] = None
    if m:
        name, value = m.groups()

    email = value.strip()

    try:
        email_validator.validate_email(email, check_deliverability=False)
    except email_validator.EmailNotValidError as e:
        raise errors.EmailError() from e

    at_index = email.index('@')
    local_part = email[:at_index]  # RFC 5321, local part must be case-sensitive.
    global_part = email[at_index:].lower()

    return name or local_part, local_part + global_part 
开发者ID:samuelcolvin,项目名称:pydantic,代码行数:33,代码来源:networks.py


注:本文中的email_validator.validate_email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。