Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
inject_securetransport.py
Go to the documentation of this file.
1"""A helper module that injects SecureTransport, on import.
2
3The import should be done as early as possible, to ensure all requests and
4sessions (or whatever) are created after injecting SecureTransport.
5
6Note that we only do the injection on macOS, when the linked OpenSSL is too
7old to handle TLSv1.2.
8"""
9
10import sys
11
12
14 # Only relevant on macOS
15 if sys.platform != "darwin":
16 return
17
18 try:
19 import ssl
20 except ImportError:
21 return
22
23 # Checks for OpenSSL 1.0.1
24 if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100F:
25 return
26
27 try:
28 from pip._vendor.urllib3.contrib import securetransport
29 except (ImportError, OSError):
30 return
31
33
34
for i