Пример #1
0
def postfilter_domain(hostname):
    """
    The 'domain' regular expression catches an entire hostname. We use the
    tldextract.extract function to extract the root domain (strip subdomains).

    >>> postfilter_domain('sub1.google.com')
    'google.com'
    """
    domain = extract(hostname)
    return "%s.%s" % (domain.domain, domain.tld)
def postfilter_domain(hostname):
    """
    The 'domain' regular expression catches an entire hostname. We use the
    tldextract.extract function to extract the root domain (strip subdomains).

    >>> postfilter_domain('sub1.google.com')
    'google.com'
    """
    domain = extract(hostname)
    return "%s.%s" % (domain.domain, domain.tld)
def postfilter_hostname(hostname):
    """
    The 'hostname' regular expression can catch hostnames with a leading dot.
    The tldextract library allows us to clean them up.

    >>> postfilter_hostname('.google.com')
    'google.com'
    """
    domain = extract(hostname)
    return '.'.join(filter(None, (domain.subdomain, domain.domain, domain.tld)))
Пример #4
0
def postfilter_hostname(hostname):
    """
    The 'hostname' regular expression can catch hostnames with a leading dot.
    The tldextract library allows us to clean them up.

    >>> postfilter_hostname('.google.com')
    'google.com'
    """
    domain = extract(hostname)
    return '.'.join(filter(None,
                           (domain.subdomain, domain.domain, domain.tld)))