title: How to get more details on a requests.exceptions.SSLError?
body: <p>When I request a URL with an expired HTTPS certificate I do not get a meaningful error from requests. Instead it gives me a cascade of &quot;<code>ssl.SSLError: A failure in the SSL library occurred</code>&quot;.</p>
  <p>See this example with <a href="https://expired.badssl.com/" rel="nofollow noreferrer">https://expired.badssl.com/</a> :</p>
  <pre><code>&gt;python
  Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
  Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
  &gt;&gt;&gt; import requests
  &gt;&gt;&gt; requests.get(&quot;https://expired.badssl.com/&quot;)
  Traceback (most recent call last):
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\urllib3\connectionpool.py&quot;, line 670, in urlopen
      httplib_response = self._make_request(
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\urllib3\connectionpool.py&quot;, line 381, in _make_request
      self._validate_conn(conn)
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\urllib3\connectionpool.py&quot;, line 978, in _validate_conn
      conn.connect()
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\urllib3\connection.py&quot;, line 362, in connect
      self.sock = ssl_wrap_socket(
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\urllib3\util\ssl_.py&quot;, line 386, in ssl_wrap_socket
      return context.wrap_socket(sock, server_hostname=server_hostname)
    File &quot;C:\Users\me\apps\Python39\lib\ssl.py&quot;, line 500, in wrap_socket
      return self.sslsocket_class._create(
    File &quot;C:\Users\me\apps\Python39\lib\ssl.py&quot;, line 1040, in _create
      self.do_handshake()
    File &quot;C:\Users\me\apps\Python39\lib\ssl.py&quot;, line 1309, in do_handshake
      self._sslobj.do_handshake()
  ssl.SSLError: A failure in the SSL library occurred (_ssl.c:1129)
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\requests\adapters.py&quot;, line 439, in send
      resp = conn.urlopen(
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\urllib3\connectionpool.py&quot;, line 726, in urlopen
      retries = retries.increment(
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\urllib3\util\retry.py&quot;, line 446, in increment
      raise MaxRetryError(_pool, url, error or ResponseError(cause))
  urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='expired.badssl.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, 'A failure in the SSL library occurred (_ssl.c:1129)')))
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\requests\api.py&quot;, line 76, in get
      return request('get', url, params=params, **kwargs)
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\requests\api.py&quot;, line 61, in request
      return session.request(method=method, url=url, **kwargs)
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\requests\sessions.py&quot;, line 530, in request
      resp = self.send(prep, **send_kwargs)
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\requests\sessions.py&quot;, line 643, in send
      r = adapter.send(request, **kwargs)
    File &quot;C:\Users\me\apps\Python39\lib\site-packages\requests\adapters.py&quot;, line 514, in send
      raise SSLError(e, request=request)
  requests.exceptions.SSLError: HTTPSConnectionPool(host='expired.badssl.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, 'A failure in the SSL library occurred (_ssl.c:1129)')))
  &gt;&gt;&gt;
  </code></pre>
  <p><code>requests</code> is 2.24.0 and <code>ssl.OPENSSL_VERSION</code> says &quot;OpenSSL 1.1.1h  22 Sep 2020&quot;. I can not update the packages.</p>
  <p>How can I get a meaningful error or error message that tells me that the certificate is expired?</p>