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


Python validators.email方法代码示例

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


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

示例1: printUsers

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def printUsers():

    table = texttable.Texttable()
    table.set_deco(texttable.Texttable.HEADER)
    table.set_cols_dtype(['i',  # int
                          't',
                          't',
                          't',
                          't'])  # text
    table.header(["ID", "USERNAME", "EMAIL", "KINDLE EMAIL", "SEND EBOOK"])

    db.connection()
    for user in User.select():
        if user.sendtokindle == 1:
            sendstatus = "YES"
        else:
            sendstatus = "NO"
        table.add_row([user.userid, user.name, user.email, user.kindle_mail, sendstatus])
    db.close()
    logging.info(table.draw()) 
开发者ID:schemen,项目名称:m2em,代码行数:22,代码来源:Helper.py

示例2: __init__

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def __init__(self, uid, username, email):
        self.uid = uid
        self.username = username
        self.email = email 
开发者ID:mimesis-lab,项目名称:mimesis-factory,代码行数:6,代码来源:test_raw_objects.py

示例3: test_account_factory_different_data

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def test_account_factory_different_data(account_factory):
    account1 = account_factory()
    account2 = account_factory()

    assert isinstance(account1, Account)
    assert isinstance(account2, Account)
    assert account1 != account2
    assert account1.uid != account2.uid
    assert account1.username != account2.username
    assert account1.email != account2.email 
开发者ID:mimesis-lab,项目名称:mimesis-factory,代码行数:12,代码来源:test_raw_objects.py

示例4: test_account_factory_overrides

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def test_account_factory_overrides(account_factory):
    username = 'sobolevn'
    desired_id = 190
    account = account_factory(username=username, uid=desired_id)

    assert account.uid == desired_id
    assert account.username == username
    assert account.email.startswith(username) 
开发者ID:mimesis-lab,项目名称:mimesis-factory,代码行数:10,代码来源:test_raw_objects.py

示例5: test_account_factory_create_batch

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def test_account_factory_create_batch(account_factory):
    accounts = account_factory.create_batch(10)
    uids = {account.uid for account in accounts}
    usernames = {account.username for account in accounts}

    assert len(accounts) == len(uids)
    assert len(accounts) == len(usernames)

    for account in accounts:
        assert isinstance(account, Account)
        assert account.uid > 0
        assert account.username != ''
        assert account.email.startswith(account.username) 
开发者ID:mimesis-lab,项目名称:mimesis-factory,代码行数:15,代码来源:test_raw_objects.py

示例6: test_account_factory_build_batch

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def test_account_factory_build_batch(account_factory):
    accounts = account_factory.build_batch(10)
    uids = {account.uid for account in accounts}
    usernames = {account.username for account in accounts}

    assert len(accounts) == len(uids)
    assert len(accounts) == len(usernames)

    for account in accounts:
        assert isinstance(account, Account)
        assert account.uid > 0
        assert account.username != ''
        assert account.email.startswith(account.username) 
开发者ID:mimesis-lab,项目名称:mimesis-factory,代码行数:15,代码来源:test_raw_objects.py

示例7: test_account_data_overrides

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def test_account_data_overrides(account):
    assert account.username in TEST_USERNAMES

    username, _ = account.email.split('@')

    assert account.username == username
    assert username in TEST_USERNAMES 
开发者ID:mimesis-lab,项目名称:mimesis-factory,代码行数:9,代码来源:test_raw_objects.py

示例8: test_account_multiple_data_overrides

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def test_account_multiple_data_overrides(account):
    assert account.username in TEST_USERNAMES
    assert 10000 <= account.uid < 10003

    username, _ = account.email.split('@')

    assert account.username == username
    assert username in TEST_USERNAMES 
开发者ID:mimesis-lab,项目名称:mimesis-factory,代码行数:10,代码来源:test_raw_objects.py

示例9: is_valid_email

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def is_valid_email(email):
    return bool(validators.email(email)) 
开发者ID:Morgan-Stanley,项目名称:testplan,代码行数:4,代码来源:validation.py

示例10: validate_result

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def validate_result(current, default, type):
    """
    Validates the data, whether it needs to be url, twitter, linkedin link etc.
    """
    if current is None:
        current = ""
    if default is None:
        default = ""
    if type == "URL" and validators.url(current, require_tld=True) and not validators.url(default, require_tld=True):
        return current
    if type == "EMAIL" and validators.email(current) and not validators.email(default):
        return current
    return default 
开发者ID:fossasia,项目名称:open-event-scraper,代码行数:15,代码来源:scraper.py

示例11: test_valid_author

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def test_valid_author():
    assert quantopian_tools.__author__
    assert validators.email(quantopian_tools.__author_email__) 
开发者ID:Gitlitio,项目名称:quantopian-tools,代码行数:5,代码来源:test_pkg_metadata.py

示例12: test_valid_maintainer

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def test_valid_maintainer():
    assert quantopian_tools.__maintainer__
    assert validators.email(quantopian_tools.__maintainer_email__) 
开发者ID:Gitlitio,项目名称:quantopian-tools,代码行数:5,代码来源:test_pkg_metadata.py

示例13: process_iocs

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def process_iocs(results):
    """Return data formatted for Splunk from ThreatCrowd."""
    if results != None:
        provided_iocs = [y for x in results for y in x.values()]
    else:
        provided_iocs = sys.argv[1:]

    session = commons.create_session()
    splunk_table = []

    for provided_ioc in set(provided_iocs):
        provided_ioc = commons.deobfuscate_string(provided_ioc)
        provided_ioc = provided_ioc.lower()

        if validators.ipv4(provided_ioc):
            ioc_type = "ip"
        elif validators.domain(provided_ioc):
            ioc_type = "domain"
        elif validators.email(provided_ioc):
            ioc_type = "email"
        elif re.match("^[a-f\d]{32}$", provided_ioc) or re.match("^[a-f\d]{64}$", provided_ioc):
            ioc_type = "resource"
        else:
            splunk_table.append({"invalid": provided_ioc})
            continue

        ioc_dicts = query_threatcrowd(provided_ioc, ioc_type, session)

        for ioc_dict in ioc_dicts:
            splunk_table.append(ioc_dict)

        if len(provided_iocs) > 1:
            sleep(10)

    session.close()
    return splunk_table 
开发者ID:ecstatic-nobel,项目名称:OSweep,代码行数:38,代码来源:threatcrowd.py

示例14: createUser

# 需要导入模块: import validators [as 别名]
# 或者: from validators import email [as 别名]
def createUser():

    # Start interactive Shell!
    while True:
        username = input("Enter User Name: ")
        if validators.truthy(username):
            break
        else:
            print("Please enter a valid username!")
            continue


    while True:
        email = input("Enter your Email: ")
        if validators.email(email):
            break
        else:
            print("Please enter a valid email!")
            continue

    while True:
        kindlemail = input("Enter your Kindle Email: ")
        if validators.email(kindlemail):
            break
        else:
            print("Please enter a valid Email!")
            continue

    while True:
        sendToKindle = input("Do you want to send Ebooks to this Account? [yes/no] ")
        if sendToKindle == "yes":
            break
        elif sendToKindle == "no":
            break
        else:
            print("Answer with yes or no.")
            continue

    logging.debug([username, email, kindlemail, sendToKindle])

    # switch sendToKindle to 0 or 1
    if sendToKindle == "yes":
        sendToKindle = "1"
    else:
        sendToKindle = "0"

    # Save data now!
    db.connection()
    newuser = User.create(email=email, name=username, sendtokindle=sendToKindle, kindle_mail=kindlemail)

    try:
        newuser.save()
    except IntegrityError as fail:
        db.rollback()
        logging.error(fail)
    finally:
        logging.info("Succesfully added user %s!", username)
    db.close() 
开发者ID:schemen,项目名称:m2em,代码行数:60,代码来源:Helper.py


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