ws.utils.TLSAdapter module

class ws.utils.TLSAdapter.TLSAdapter(*, ssl_options=0, **kwargs)

Bases: requests.adapters.HTTPAdapter

Snippet based on https://stackoverflow.com/a/44432829

Example:

session = requests.session() # disallow TLS1.0 and TLS1.1, allow only TLS1.2 (and newer if suported # by the used openssl version) adapter = TLSAdapter(ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1) session.mount(”https://”, adapter)

init_poolmanager(*pool_args, **pool_kwargs)

Initializes a urllib3 PoolManager.

This method should not be called from user code, and is only exposed for use when subclassing the HTTPAdapter.

Parameters
  • connections – The number of urllib3 connection pools to cache.

  • maxsize – The maximum number of connections to save in the pool.

  • block – Block when no free connections are available.

  • pool_kwargs – Extra keyword arguments used to initialize the Pool Manager.