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


Python email_validator.EmailNotValidError方法代码示例

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


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

示例1: test_email_invalid

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import EmailNotValidError [as 别名]
def test_email_invalid():
    with pytest.raises(EmailNotValidError):
        EmailNotification('foo') 
开发者ID:Nike-Inc,项目名称:signal_analog,代码行数:5,代码来源:test_signal_analog_detectors.py

示例2: is_valid_email_address

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import EmailNotValidError [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 EmailNotValidError [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: check_value

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import EmailNotValidError [as 别名]
def check_value(self, value):
        try:
            validate_email(value,
                           allow_smtputf8=self.allow_smtputf8,
                           check_deliverability=self.check_deliverability,
                           allow_empty_local=self.allow_empty_local)
            return True
        except EmailNotValidError:
            return False 
开发者ID:xeBuz,项目名称:Flask-Validator,代码行数:11,代码来源:internet.py

示例5: get_mfa

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import EmailNotValidError [as 别名]
def get_mfa(self, username):
        try:
          validate_email(username)
          accountType = 2 # email
        except EmailNotValidError as _e:
          accountType = 1 # phone

        response = requests.get(self._urls.get_mfa(username, str(accountType), str(self._did), str(5), str(1)), headers=self._headers) 
开发者ID:tedchou12,项目名称:webull,代码行数:10,代码来源:webull.py

示例6: validate_email

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import EmailNotValidError [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

示例7: login

# 需要导入模块: import email_validator [as 别名]
# 或者: from email_validator import EmailNotValidError [as 别名]
def login(self, username='', password='', device_name='', mfa=''):
        '''
        Login with email or phone number

        phone numbers must be a str in the following form
        US '+1-XXXXXXX'
        CH '+86-XXXXXXXXXXX'
        '''

        if not username or not password:
            raise ValueError('username or password is empty')

        # with webull md5 hash salted
        password = ('wl_app-a&b@!423^' + password).encode('utf-8')
        md5_hash = hashlib.md5(password)

        try:
          validate_email(username)
          accountType = 2 # email
        except EmailNotValidError as _e:
          accountType = 1 # phone

        if device_name == '' :
            device_name = 'default_string'

        data = {
            'account': username,
            'accountType': accountType,
            'deviceId': self._did,
            'deviceName': device_name,
            'grade': 1,
            'pwd': md5_hash.hexdigest(),
            'regionId': 1
        }

        if mfa != '' :
            data['extInfo'] = {'verificationCode': mfa}
            headers = self.build_req_headers()
        else :
            headers = self._headers
        response = requests.post(self._urls.login(), json=data, headers=headers)
        result = response.json()
        if 'accessToken' in result :
            self._access_token = result['accessToken']
            self._refresh_token = result['refreshToken']
            self._token_expire = result['tokenExpireTime']
            self._uuid = result['uuid']
            self._account_id = self.get_account_id()
        return result 
开发者ID:tedchou12,项目名称:webull,代码行数:51,代码来源:webull.py


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