File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1515"""Support for SSL in PyMongo."""
1616from __future__ import annotations
1717
18+ import warnings
1819from typing import Optional
1920
2021from pymongo .errors import ConfigurationError
2324
2425try :
2526 import pymongo .pyopenssl_context as _ssl
26- except ImportError :
27+ except (ImportError , AttributeError ) as exc :
28+ if isinstance (exc , AttributeError ):
29+ warnings .warn (
30+ "Failed to use the installed version of PyOpenSSL. "
31+ "Falling back to stdlib ssl, disabling OCSP support. "
32+ "This is likely caused by incompatible versions "
33+ "of PyOpenSSL < 23.2.0 and cryptography >= 42.0.0. "
34+ "Try updating PyOpenSSL >= 23.2.0 to enable OCSP." ,
35+ UserWarning ,
36+ stacklevel = 2 ,
37+ )
2738 try :
2839 import pymongo .ssl_context as _ssl # type: ignore[no-redef]
2940 except ImportError :
You can’t perform that action at this time.
0 commit comments