K
That's interesting, I get that same cryptic error when I test directly over an SSL socket with a bogus certificate:
>>> s = socket.socket()
>>> ss = ssl.wrap_socket(s, cert_reqs=ssl.CERT_REQUIRED, ca_certs=bad_cert)
>>> ss.connect(socket.getaddrinfo(host, 443)[0][-1])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: -9984
With other "wrong" certificates I've gotten OSError: [Errno -30592] MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE instead. Not sure why the difference.
Anyway, I know this post is old, just putting this here in case it helps someone in the future.
K