def _get_html_page(link, session=None):
    if (session is None):
        raise TypeError("_get_html_page() missing 1 required keyword argument: 'session'")
    url = link.url.split('#', 1)[0]
    vcs_scheme = _match_vcs_scheme(url)
    if vcs_scheme:
        logger.debug('Cannot look at %s URL %s', vcs_scheme, link)
        return None
    (scheme, _, path, _, _, _) = urllib_parse.urlparse(url)
    if ((scheme == 'file') and os.path.isdir(urllib_request.url2pathname(path))):
        if (not url.endswith('/')):
            url += '/'
        url = urllib_parse.urljoin(url, 'index.html')
        logger.debug(' file: URL is directory, getting %s', url)
    try:
        resp = _get_html_response(url, session=session)
    except _NotHTTP:
        logger.debug('Skipping page %s because it looks like an archive, and cannot be checked by HEAD.', link)
    except _NotHTML as exc:
        logger.warning('Skipping page %s because the %s request got Content-Type: %s.The only supported Content-Type is text/html', link, exc.request_desc, exc.content_type)
    except HTTPError as exc:
        _handle_get_page_fail(link, exc)
    except RetryError as exc:
        _handle_get_page_fail(link, exc)
    except SSLError as exc:
        reason = 'There was a problem confirming the ssl certificate: '
        reason += str(exc)
        _handle_get_page_fail(link, reason, meth=logger.info)
    except requests.ConnectionError as exc:
        _handle_get_page_fail(link, 'connection error: {}'.format(exc))
    except requests.Timeout:
        _handle_get_page_fail(link, 'timed out')
    else:
        return _make_html_page(resp, cache_link_parsing=link.cache_link_parsing)
    return None
def _get_html_page(link, session=None):
    if (session is None):
        raise TypeError("_get_html_page() missing 1 required keyword argument: 'session'")
    url = link.url.split('#', 1)[0]
    vcs_scheme = _match_vcs_scheme(url)
    if vcs_scheme:
        logger.debug('Cannot look at %s URL %s', vcs_scheme, link)
        return None
    (scheme, _, path, _, _, _) = urllib_parse.urlparse(url)
    if ((scheme == 'file') and os.path.isdir(urllib_request.url2pathname(path))):
        if (not url.endswith('/')):
            url += '/'
        url = urllib_parse.urljoin(url, 'index.html')
        logger.debug(' file: URL is directory, getting %s', url)
    try:
        resp = _get_html_response(url, session=session)
    except _NotHTTP:
        logger.debug('Skipping page %s because it looks like an archive, and cannot be checked by HEAD.', link)
    except _NotHTML as exc:
        logger.warning('Skipping page %s because the %s request got Content-Type: %s.The only supported Content-Type is text/html', link, exc.request_desc, exc.content_type)
    except HTTPError as exc:
        _handle_get_page_fail(link, exc)
    except RetryError as exc:
        _handle_get_page_fail(link, exc)
    except SSLError as exc:
        reason = 'There was a problem confirming the ssl certificate: '
        reason += str(exc)
        _handle_get_page_fail(link, reason, meth=logger.info)
    except requests.ConnectionError as exc:
        _handle_get_page_fail(link, 'connection error: {}'.format(exc))
    except requests.Timeout:
        _handle_get_page_fail(link, 'timed out')
    else:
        return _make_html_page(resp, cache_link_parsing=link.cache_link_parsing)
    return None