macOS SecureTransport#

Warning

DEPRECATED: This module is deprecated and will be removed in urllib3 v2.1.0. Read more in this issue.

SecureTranport support for urllib3 via ctypes.

This makes platform-native TLS available to urllib3 users on macOS without the use of a compiler. This is an important feature because the Python Package Index is moving to become a TLSv1.2-or-higher server, and the default OpenSSL that ships with macOS is not capable of doing TLSv1.2. The only way to resolve this is to give macOS users an alternative solution to the problem, and that solution is to use SecureTransport.

We use ctypes here because this solution must not require a compiler. That’s because Pip is not allowed to require a compiler either.

This code is a bastardised version of the code found in Will Bond’s oscrypto library. An enormous debt is owed to him for blazing this trail for us. For that reason, this code should be considered to be covered both by urllib3’s license and by oscrypto’s.

To use this module, simply import and inject it:

import urllib3.contrib.securetransport
urllib3.contrib.securetransport.inject_into_urllib3()