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 15
15
"""Support for SSL in PyMongo."""
16
16
from __future__ import annotations
17
17
18
+ import warnings
18
19
from typing import Optional
19
20
20
21
from pymongo .errors import ConfigurationError
23
24
24
25
try :
25
26
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
+ )
27
38
try :
28
39
import pymongo .ssl_context as _ssl # type: ignore[no-redef]
29
40
except ImportError :
You can’t perform that action at this time.
0 commit comments