module documentation

Undocumented

Function create_urllib3_context All arguments have the same meaning as ``ssl_wrap_socket``.
Function is_ipaddress Detects whether the hostname given is an IPv4 or IPv6 address. Also detects IPv6 addresses with Zone IDs.
Constant DEFAULT_CIPHERS Undocumented
Constant HASHFUNC_MAP Undocumented
Variable SSLTransport Undocumented
Function _const_compare_digest_backport Compare two digests of equal length in constant time.
Function _is_key_file_encrypted Detects if a key file is encrypted or not.
Function _ssl_wrap_socket_impl Undocumented
Variable _const_compare_digest Undocumented
def create_urllib3_context(ssl_version=None, cert_reqs=None, options=None, ciphers=None): (source)

All arguments have the same meaning as ``ssl_wrap_socket``. By default, this function does a lot of the same work that ``ssl.create_default_context`` does on Python 3.4+. It: - Disables SSLv2, SSLv3, and compression - Sets a restricted set of server ciphers If you wish to enable SSLv3, you can do:: from urllib3.util import ssl_ context = ssl_.create_urllib3_context() context.options &= ~ssl_.OP_NO_SSLv3 You can do the same to enable compression (substituting ``COMPRESSION`` for ``SSLv3`` in the last line above). :param ssl_version: The desired protocol version to use. This will default to PROTOCOL_SSLv23 which will negotiate the highest protocol that both the server and your installation of OpenSSL support. :param cert_reqs: Whether to require the certificate verification. This defaults to ``ssl.CERT_REQUIRED``. :param options: Specific OpenSSL options. These default to ``ssl.OP_NO_SSLv2``, ``ssl.OP_NO_SSLv3``, ``ssl.OP_NO_COMPRESSION``, and ``ssl.OP_NO_TICKET``. :param ciphers: Which cipher suites to allow the server to select. :returns: Constructed SSLContext object with specified options :rtype: SSLContext

def is_ipaddress(hostname): (source)

Detects whether the hostname given is an IPv4 or IPv6 address. Also detects IPv6 addresses with Zone IDs. :param str hostname: Hostname to examine. :return: True if the hostname is an IP address, False otherwise.

DEFAULT_CIPHERS = (source)

Undocumented

Value
""":""".join(['ECDHE+AESGCM',
              'ECDHE+CHACHA20',
              'DHE+AESGCM',
              'DHE+CHACHA20',
              'ECDH+AESGCM',
              'DH+AESGCM',
              'ECDH+AES',
...
HASHFUNC_MAP = (source)

Undocumented

Value
{32: md5, 40: sha1, 64: sha256}
SSLTransport = (source)

Undocumented

def _const_compare_digest_backport(a, b): (source)

Compare two digests of equal length in constant time. The digests must be of type str/bytes. Returns True if the digests match, and False otherwise.

def _is_key_file_encrypted(key_file): (source)

Detects if a key file is encrypted or not.

def _ssl_wrap_socket_impl(sock, ssl_context, tls_in_tls, server_hostname=None): (source)

Undocumented

_const_compare_digest = (source)

Undocumented