def _get_html_response(url, session):
    'Access an HTML page with GET, and return the response.\n\n    This consists of three parts:\n\n    1. If the URL looks suspiciously like an archive, send a HEAD first to\n       check the Content-Type is HTML, to avoid downloading a large file.\n       Raise `_NotHTTP` if the content type cannot be determined, or\n       `_NotHTML` if it is not HTML.\n    2. Actually perform the request. Raise HTTP exceptions on network failures.\n    3. Check the Content-Type header to make sure we got HTML, and raise\n       `_NotHTML` otherwise.\n    '
    if _is_url_like_archive(url):
        _ensure_html_response(url, session=session)
    logger.debug('Getting page %s', redact_auth_from_url(url))
    resp = session.get(url, headers={'Accept': 'text/html', 'Cache-Control': 'max-age=0'})
    resp.raise_for_status()
    _ensure_html_header(resp)
    return resp
Access an HTML page with GET, and return the response.

This consists of three parts:

1. If the URL looks suspiciously like an archive, send a HEAD first to
   check the Content-Type is HTML, to avoid downloading a large file.
   Raise `_NotHTTP` if the content type cannot be determined, or
   `_NotHTML` if it is not HTML.
2. Actually perform the request. Raise HTTP exceptions on network failures.
3. Check the Content-Type header to make sure we got HTML, and raise
   `_NotHTML` otherwise.
def _get_html_response(url, session):
    'Access an HTML page with GET, and return the response.\n\n    This consists of three parts:\n\n    1. If the URL looks suspiciously like an archive, send a HEAD first to\n       check the Content-Type is HTML, to avoid downloading a large file.\n       Raise `_NotHTTP` if the content type cannot be determined, or\n       `_NotHTML` if it is not HTML.\n    2. Actually perform the request. Raise HTTP exceptions on network failures.\n    3. Check the Content-Type header to make sure we got HTML, and raise\n       `_NotHTML` otherwise.\n    '
    if _is_url_like_archive(url):
        _ensure_html_response(url, session=session)
    logger.debug('Getting page %s', redact_auth_from_url(url))
    resp = session.get(url, headers={'Accept': 'text/html', 'Cache-Control': 'max-age=0'})
    resp.raise_for_status()
    _ensure_html_header(resp)
    return resp