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


Python validate_email.validate_email方法代码示例

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


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

示例1: __init__

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def __init__(self, email, password, first_name=None, last_name=None,
            address=None, address2=None, city=None, state=None, zip=None):

        self.create_date    = datetime.now()

        if not email:
            raise ValidationError('ACCOUNTS_MISSING_EMAIL')
        elif not validate_email(email):
            raise ValidationError('ACCOUNTS_BAD_EMAIL')
        else:
            self.email      = email

        if not password:
            raise ValidationError('ACCOUNTS_MISSING_PASSWORD')
        else:
            self.password   = password_hash(password)

        self.api_key        = random_hash("%s%s" % (email, self.password))
        self.first_name     = first_name
        self.last_name      = last_name
        self.address        = address
        self.address2       = address2
        self.city           = city
        self.state          = state
        self.zip            = zip 
开发者ID:lyonbros,项目名称:faxrobot,代码行数:27,代码来源:account.py

示例2: add_email

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def add_email(message):
        user_lang(message)
        try:
            text = message.text.lower()
        except AttributeError:
            text = None
        if text in cmds:
            return 0
        elif '/' not in message.text:
            if validate_email(message.text.lower()):
                upd_user_email(db, table, message.from_user.id, '"' +
                    str(message.text) + '"')
                data = select_user(db, table, message.from_user.id, '*')
                if '@' not in str(data[3]):
                    msg = bot.reply_to(message, i18n.t('bot.askemail'))
                    bot.register_next_step_handler(msg, add_email)
                    return 0
                if '@' not in str(data[2]):
                    msg = bot.reply_to(message, i18n.t('bot.askemail2'))
                    bot.register_next_step_handler(msg, add_email)
                    return 0
                msg = bot.reply_to(message,
                    str(u'\U00002705') + i18n.t('bot.success'),
                    parse_mode='HTML', reply_markup=button)
            else:
                msg = bot.send_message(message.from_user.id, str(u'\U000026A0')
                    + i18n.t('bot.askemail'), parse_mode='HTML')
                bot.register_next_step_handler(msg, add_email)
        else:
            msg = bot.send_message(message.from_user.id,
            i18n.t('bot.askemail'), parse_mode='HTML')
            bot.register_next_step_handler(msg, add_email) 
开发者ID:GabrielRF,项目名称:Send2KindleBot,代码行数:34,代码来源:pdftokindlebot.py

示例3: search

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def search():
    inputfil = raw_input("Type the path of file containing a list of emails: ")
    with open(inputfil) as inputfile:
        for line in inputfile:
            results.append(line.strip())
    count = 0
    for i in results:
        is_valid = validate_email(i,verify=True)
        count += 1
        if str(is_valid).upper() == "TRUE":
	    stdout.write(GREEN + "[*] FOUND - [" + i + "] "+ BLUE + "{line " + str(count) + "}\n" + END)
        else:
            stdout.write(RED + "[!] NOTFD - [" + i + "]" + BLUE + " {line " + str(count) + "}\n" + END) 
开发者ID:4w4k3,项目名称:KnockMail,代码行数:15,代码来源:knock.py

示例4: single

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def single():
    ema = raw_input("Type the email to search: ")
    is_valid = validate_email(ema,verify=True)
    if str(is_valid).upper() == "TRUE":
        stdout.write(GREEN + "[*] FOUND - [" + ema + "]\n" + END)
    else:
	stdout.write(RED + "[!] NOTFD - [" + ema + "]\n" + END) 
开发者ID:4w4k3,项目名称:KnockMail,代码行数:9,代码来源:knock.py

示例5: email_validator

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def email_validator(value, **kwargs):
    if not validate_email.validate_email(value):
        raise ValidationError(MESSAGES['format']['invalid_email'].format(value)) 
开发者ID:pipermerriam,项目名称:flex,代码行数:5,代码来源:formats.py

示例6: _email_or_md5

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def _email_or_md5(s):
    if validate_email(s) or re.match(r"^[0-9A-Fa-f]{32}$", s):
        return s
    raise ValueError


# based off of:
# http://stackoverflow.com/questions/2532053/validate-a-hostname-string 
开发者ID:maxmind,项目名称:minfraud-api-python,代码行数:10,代码来源:validation.py

示例7: check_valid_email

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def check_valid_email(func):
  @six.wraps(func)
  def decorator(request, email, *args, **kwargs):
    if not validate_email.validate_email(email):
      raise stethoscope.exceptions.ValidationError("email address", email)
    return func(request, email, *args, **kwargs)
  return decorator 
开发者ID:Netflix-Skunkworks,项目名称:stethoscope,代码行数:9,代码来源:validation.py

示例8: main

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def main():
    #Imprimimos el banner
    print(config.banner)

    nick = input("Insert nick:")

    #Buscamos en Facebook
    facebook.get_postsFB(nick)

    #Buscamos emails
    for email in emails:
        target = nick + email
        try:
            is_valid = validate_email(target, check_regex=True, check_mx=True, smtp_timeout=10, dns_timeout=10, use_blacklist=True)
            if is_valid:
                print("|----[INFO][EMAIL][>] " + target)
                print("|--------[INFO][EMAIL][>] Email validated...")
            else:

                print("|----[INFO][TARGET][>] " + target)
                print("|--------[INFO][EMAIL][>] It's not created...")

        except Exception as e:
            
            print(e)
            print("[INFO][TARGET][>] " + target)
            print("|--[INFO][EMAIL] No verification possible... ")

    #Buscamos en las plataformas
    print("This process may take a few minutes...")
    r_nicks = getnickWebs(nick)

    for n in r_nicks:

        print("|----[INFO][" + n.upper() + "][>] " + r_nicks.get(n).replace("data", nick))

    print("|")
    print("|----[INFO][START] Scanning emails with nicks...")
    print("|") 
开发者ID:Quantika14,项目名称:osint-suite-tools,代码行数:41,代码来源:BuscadorNick.py

示例9: send_login_email

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def send_login_email(request_source_url, email):
  if not validate_email(email):
    raise LoginEmailException('Please provide a valid email address')

  email_login_link_object = models.EmailLoginLink(email=email,
                                                  secret=utils.generate_secret(32))
  email_login_link_object.put()

  html_template = JINJA_ENVIRONMENT.get_template('auth/login_link_email.html')
  txt_template = JINJA_ENVIRONMENT.get_template('auth/login_link_email.txt')

  if '/play_queued_request' in request_source_url:
    emailed_url = request_source_url
  else:
    scheme, remainder = request_source_url.split('://')
    emailed_url = '%s://%s/_/auth/email_callback' % (scheme, remainder.split('/')[0])

  login_url = '%s?%s' % (emailed_url,
                         urllib.urlencode({'e': email, 's': email_login_link_object.secret}))

  html = html_template.render({'login_url': login_url})
  text = txt_template.render({'login_url': login_url})

  email_data = {'recipient_email': email,
                'subject': 'Log in to Trotto',
                'plaintext': text,
                'html': html}

  deferred.defer(email_helper.send_email,
                 email_data) 
开发者ID:trotto,项目名称:go-links,代码行数:32,代码来源:helpers.py

示例10: filterEmails

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def filterEmails(email):
    """Filter email address
    """
    try:
        if validate_email.validate_email(email, check_mx=False):
            return "", email
        return email, ""
    except:
        return email, "" 
开发者ID:pielco11,项目名称:DOT,代码行数:11,代码来源:2getpy.py

示例11: create_record

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def create_record():
    """Create a book request record
    @param email: post : the requesters email address
    @param title: post : the title of the book requested
    @return: 201: a new_uuid as a flask/response object \
    with application/json mimetype.
    @raise 400: misunderstood request
    """
    if not request.get_json():
        abort(400)
    data = request.get_json(force=True)

    if not data.get('email'):
        abort(400)
    if not validate_email(data['email']):
        abort(400)
    if not data.get('title'):
        abort(400)

    new_uuid = str(uuid.uuid4())
    book_request = {
        'title': data['title'],
        'email': data['email'],
        'timestamp': datetime.now().timestamp()
    }
    BOOK_REQUESTS[new_uuid] = book_request
    # HTTP 201 Created
    return jsonify({"id": new_uuid}), 201 
开发者ID:Sean-Bradley,项目名称:Seans-Python3-Flask-Rest-Boilerplate,代码行数:30,代码来源:request_api.py

示例12: edit_record

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def edit_record(_id):
    """Edit a book request record
    @param email: post : the requesters email address
    @param title: post : the title of the book requested
    @return: 200: a booke_request as a flask/response object \
    with application/json mimetype.
    @raise 400: misunderstood request
    """
    if _id not in BOOK_REQUESTS:
        abort(404)

    if not request.get_json():
        abort(400)
    data = request.get_json(force=True)

    if not data.get('email'):
        abort(400)
    if not validate_email(data['email']):
        abort(400)
    if not data.get('title'):
        abort(400)

    book_request = {
        'title': data['title'],
        'email': data['email'],
        'timestamp': datetime.now().timestamp()
    }

    BOOK_REQUESTS[_id] = book_request
    return jsonify(BOOK_REQUESTS[_id]), 200 
开发者ID:Sean-Bradley,项目名称:Seans-Python3-Flask-Rest-Boilerplate,代码行数:32,代码来源:request_api.py

示例13: validate

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def validate(self):

        if not self.email:
            raise ValidationError('ACCOUNTS_MISSING_EMAIL')

        if not validate_email(self.email):
            raise ValidationError('ACCOUNTS_BAD_EMAIL')

        if self.first_name and len(self.first_name) > 255:
            raise ValidationError('ACCOUNTS_BAD_FIRST_NAME')

        if self.last_name and len(self.last_name) > 255:
            raise ValidationError('ACCOUNTS_BAD_LAST_NAME')

        if self.address and len(self.address) > 255:
            raise ValidationError('ACCOUNTS_BAD_ADDRESS')

        if self.address2 and len(self.address2) > 255:
            raise ValidationError('ACCOUNTS_BAD_ADDRESS2')

        if self.city and len(self.city) > 255:
            raise ValidationError('ACCOUNTS_BAD_CITY')

        if self.state and len(self.state) > 64:
            raise ValidationError('ACCOUNTS_BAD_STATE')

        if self.zip and len(self.zip) > 24:
            raise ValidationError('ACCOUNTS_BAD_ZIP')

        if self.email_success and self.email_success != 0 and \
                self.email_success != 1:
            raise ValidationError('ACCOUNTS_BAD_REQUEST')

        if self.email_fail and self.email_fail != 0 and self.email_fail != 1:
            raise ValidationError('ACCOUNTS_BAD_REQUEST')

        if self.email_list and self.email_list != 0 and self.email_list != 1:
            raise ValidationError('ACCOUNTS_BAD_REQUEST')

        return True 
开发者ID:lyonbros,项目名称:faxrobot,代码行数:42,代码来源:account.py

示例14: author_email_pairs

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def author_email_pairs(self):
        unknown_author_response = [{"name": "UNKNOWN", "email": None}]

        clean_byline = self._clean_byline()
        if not clean_byline:
            return unknown_author_response

        responses = []
        for author_clause in clean_byline.split(","):
            author_name = None
            author_email = None

            clause_replace_patterns = [
                "\(.*?\)",   # here so can get before comma split            
                "\[.*?\]",
                "\[.*?$"
                ]
            for pattern in clause_replace_patterns:
                author_clause = re.sub(pattern, "", author_clause, re.IGNORECASE)

            if not author_clause or (len(author_clause) < 6):
                pass

            if "<" in author_clause:
                (author_name, author_email) = author_clause.split("<", 1)
                author_email = re.sub("(>.*)", "", author_email)
                if not validate_email(author_email):
                    author_email = None
            else:
                author_name = author_clause

            if author_name:
                author_name = author_name.strip("\t .'(")
                author_name = author_name.strip('"')

            if author_name or author_email:
                responses.append({"name":author_name, "email":author_email})

        if not responses:
            responses = unknown_author_response

        return responses 
开发者ID:ourresearch,项目名称:depsy,代码行数:44,代码来源:byline.py

示例15: message_factory

# 需要导入模块: import validate_email [as 别名]
# 或者: from validate_email import validate_email [as 别名]
def message_factory(**kwargs):

    request = get_current_request()
    application_settings = request.registry.application_settings

    settings = request.runtime_settings

    # EmailMessage builder
    message = EmailMessage(application_settings.smtp, settings.vendor.email)

    if 'reply' in settings.vendor.email.addressbook:
        message.add_reply(read_list(settings.vendor.email.addressbook.reply))

    is_support_email = False
    if 'recipients' in kwargs:
        for recipient in kwargs['recipients']:
            if recipient == 'support':
                is_support_email = True
            if recipient in settings.vendor.email.addressbook:
                message.add_recipient(read_list(settings.vendor.email.addressbook[recipient]))
            else:
                log.warning('Could not add recipient {}'.format(recipient))

    # Extend "To" and "Reply-To" addresses by email address of user
    #request.user.username = 'test@example.org'; request.user.fullname = 'Hello World'   # debugging
    if request.user.username:
        username = request.user.username
        if validate_email(username):
            if request.user.fullname:
                pair = (request.user.fullname, username)
            else:
                pair = (None, username)

            try:
                user_email = formataddr(pair)
            except Exception as ex:
                log.warning('Computing "user_email" failed: Could not decode email address from "{}": {}'.format(username, ex))
                return message

            # Add user email as "Reply-To" address
            message.add_reply(user_email)

            # If it's a support email, also add user herself as a recipient
            if is_support_email:
                message.add_recipient(user_email)

        else:
            log.warning('Computing "user_email" failed: Email address "{}" is invalid'.format(username))

    return message 
开发者ID:ip-tools,项目名称:patzilla,代码行数:52,代码来源:submit.py


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