Mocking an SSLError in Python
I’ve been dealing with the ssl.SSLError: [SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled issue described here. As part of the fix, I’m attempting to write in exception-handling for the exception: try: return req() except (ssl.SSLError, RSSLError) as ssl_err: print(ssl_err) if "UNSAFE_LEGACY_RENEGOTIATION_DISABLED" in str(ssl_err): ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH) ctx.options |= 0x4 self._sess.mount("https://", CustomHttpAdapter(ctx)) return req() raise The issue… Read More Mocking an SSLError in Python