(url, session)
Send a HEAD request to the URL, and ensure the response contains HTML.

    Raises `_NotHTTP` if the URL is not available for a HEAD request, or
    `_NotHTML` if the content type is not text/html.
Send a HEAD request to the URL, and ensure the response contains HTML.
Send a HEAD request to the URL and ensure the response contains HTML .
def _ensure_html_response(url, session):
    # type: (str, PipSession) -> None
    """Send a HEAD request to the URL, and ensure the response contains HTML.

    Raises `_NotHTTP` if the URL is not available for a HEAD request, or
    `_NotHTML` if the content type is not text/html.
    """
    scheme, netloc, path, query, fragment = urllib_parse.urlsplit(url)
    if scheme not in {'http', 'https'}:
        raise _NotHTTP()

    resp = session.head(url, allow_redirects=True)
    resp.raise_for_status()

    _ensure_html_header(resp)
def _ensure_html_response ( url , session ) : # type: (str, PipSession) -> None scheme , netloc , path , query , fragment = urllib_parse . urlsplit ( url ) if scheme not in { 'http' , 'https' } : raise _NotHTTP ( ) resp = session . head ( url , allow_redirects = True ) resp . raise_for_status ( ) _ensure_html_header ( resp )