module documentation

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 is not intended to be a seriously long-term solution to this problem. The hope is that PEP 543 will eventually solve this issue for us, at which point we can retire this contrib module. But in the short term, we need to solve the impending tire fire that is Python on Mac without this kind of contrib module. So...here we are. To use this module, simply import and inject it:: import urllib3.contrib.securetransport urllib3.contrib.securetransport.inject_into_urllib3() Happy TLSing! 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: .. code-block:: Copyright (c) 2015-2016 Will Bond <will@wbond.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Class SecureTransportContext I am a wrapper class for the SecureTransport library, to translate the interface of the standard library ``SSLContext`` object to calls into SecureTransport.
Class WrappedSocket API-compatibility wrapper for Python's OpenSSL wrapped socket object.
Function extract_from_urllib3 Undo monkey-patching by :func:`inject_into_urllib3`.
Function inject_into_urllib3 Monkey-patch urllib3 with SecureTransport-backed SSL-support.
Function makefile Undocumented
Constant CIPHER_SUITES Undocumented
Constant HAS_SNI Undocumented
Constant SSL_WRITE_BLOCKSIZE Undocumented
Function _read_callback SecureTransport read callback. This is called by ST to request that data be returned from the socket.
Function _write_callback SecureTransport write callback. This is called by ST to request that data actually be sent on the network.
Variable _connection_ref_lock Undocumented
Variable _connection_refs Undocumented
Variable _protocol_to_min_max Undocumented
Variable _read_callback_pointer Undocumented
Variable _write_callback_pointer Undocumented
def extract_from_urllib3(): (source)

Undo monkey-patching by :func:`inject_into_urllib3`.

def inject_into_urllib3(): (source)

Monkey-patch urllib3 with SecureTransport-backed SSL-support.

def makefile(self, mode, bufsize=-1): (source)

Undocumented

Undocumented

Value
True
SSL_WRITE_BLOCKSIZE: int = (source)

Undocumented

Value
16384
def _read_callback(connection_id, data_buffer, data_length_pointer): (source)

SecureTransport read callback. This is called by ST to request that data be returned from the socket.

def _write_callback(connection_id, data_buffer, data_length_pointer): (source)

SecureTransport write callback. This is called by ST to request that data actually be sent on the network.

_connection_ref_lock = (source)

Undocumented

_connection_refs = (source)

Undocumented

_protocol_to_min_max = (source)

Undocumented

_read_callback_pointer = (source)

Undocumented

_write_callback_pointer = (source)

Undocumented