How to use the tld.update_tld_names function in tld

To help you get started, we’ve selected a few tld examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HaliteChallenge / Halite-III / apiserver / apiserver / web / user.py View on Github external
import re
import uuid

import flask
import sqlalchemy
import tld

from .. import config, model, notify, util

from . import util as web_util
from .blueprint import web_api

from profanity import profanity
import wordfilter

tld.update_tld_names()


USERNAME_REGEX = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_\-]*$')
USERNAME_LENGTH = 40


def is_valid_username(username):
    return len(username) <= USERNAME_LENGTH and \
        username and \
        not profanity.contains_profanity(username) and \
        not wordfilter.blacklisted(username) and \
        USERNAME_REGEX.match(username)


def make_user_record(row, *, logged_in, total_users=None):
    """Given a database result row, create the JSON user object."""

tld

Extract the top-level domain (TLD) from the URL given.

MPL-1.1 OR GPL-2.0-only OR LG…
Latest version published 2 years ago

Package Health Score

76 / 100
Full package analysis