def get_con_pool(host,
                 key_file=None,
                 cert_file=None,
                 socket_timeout=15.0,
                 max_pool_size=3,
                 verify_https=True):
    """
    Return a ConnectionPool instance of given host
    :param socket_timeout:
        socket timeout for each connection in seconds
    """
    kwargs = {
        "timeout": socket_timeout,
        "maxsize": max_pool_size,
        "block": True,
        }

    if key_file is not None and cert_file is not None:
        kwargs["key_file"] = key_file
        kwargs["cert_file"] = cert_file

    if urlparse(host).scheme == "https":
        kwargs["ssl_version"] = ssl.PROTOCOL_TLSv1
        if verify_https:
            kwargs["cert_reqs"] = "CERT_REQUIRED"
            kwargs["ca_certs"] = getattr(settings, "RESTCLIENTS_CA_BUNDLE",
                                         "/etc/ssl/certs/ca-bundle.crt")

    return connection_from_url(host, **kwargs)
def get_con_pool ( host , key_file = None , cert_file = None , socket_timeout = 15.0 , max_pool_size = 3 , verify_https = True ) : kwargs = { "timeout" : socket_timeout , "maxsize" : max_pool_size , "block" : True , } if key_file is not None and cert_file is not None : kwargs [ "key_file" ] = key_file kwargs [ "cert_file" ] = cert_file if urlparse ( host ) . scheme == "https" : kwargs [ "ssl_version" ] = ssl . PROTOCOL_TLSv1 if verify_https : kwargs [ "cert_reqs" ] = "CERT_REQUIRED" kwargs [ "ca_certs" ] = getattr ( settings , "RESTCLIENTS_CA_BUNDLE" , "/etc/ssl/certs/ca-bundle.crt" ) return connection_from_url ( host , ** kwargs )
Return a ConnectionPool instance of given host
    :param socket_timeout:
        socket timeout for each connection in seconds