當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。