def get_host(url):

    # This code is actually similar to urlparse.urlsplit, but much
    # simplified for our needs.
    port = None
    scheme = 'http'

    if '://' in url:
        scheme, url = url.split('://', 1)
    if '/' in url:
        url, _path = url.split('/', 1)
    if '@' in url:
        _auth, url = url.split('@', 1)
    if ':' in url:
        url, port = url.split(':', 1)

        if not port.isdigit():
            raise LocationParseError("Failed to parse: %s")

        port = int(port)

    return scheme, url, port
Given a url, return its scheme, host and port (None if it's not there).
dataset/ETHPy150Open lmorchard/badg.us/vendor-local/lib/python/requests/packages/urllib3/connectionpool.py/get_host