(url)
Returns the domain name of a URL

    >>> get_domain('http://example.com')
    'example.com'

    >>> get_domain('https://example.com:80/my-podcast/feed.rss')
    'example.com'
Returns the domain name of a URL
Returns the domain name of a URL
def get_domain(url):
    """Returns the domain name of a URL

    >>> get_domain('http://example.com')
    'example.com'

    >>> get_domain('https://example.com:80/my-podcast/feed.rss')
    'example.com'
    """
    netloc = urllib.parse.urlparse(url).netloc
    try:
        port_idx = netloc.index(":")
        return netloc[:port_idx]

    except ValueError:
        return netloc
def get_domain ( url ) : netloc = urllib . parse . urlparse ( url ) . netloc try : port_idx = netloc . index ( ":" ) return netloc [ : port_idx ] except ValueError : return netloc