(url, domains)
return any((host == d) or (host.endswith(f'.{d}')) for d in domains)
Return True if the url belongs to any of the given domains
Return True if the url belongs to any of the given domains
Return True if the url belongs to any of the given domains
def url_is_from_any_domain(url, domains):
    """Return True if the url belongs to any of the given domains"""
    host = parse_url(url).netloc.lower()
    if not host:
        return False
    domains = [d.lower() for d in domains]
    return any((host == d) or (host.endswith(f'.{d}')) for d in domains)
def url_is_from_any_domain ( url , domains ) : host = parse_url ( url ) . netloc . lower ( ) if not host : return False domains = [ d . lower ( ) for d in domains ] return any ( ( host == d ) or ( host . endswith ( f'.{d}' ) ) for d in domains )