def hook_get_client(req, resp, kwargs):
    endpoint = cfg.CONF['softlayer']['endpoint']
    client = SoftLayer.Client(endpoint_url=endpoint)
    client.auth = None
    req.env['tenant_id'] = None

    if req.headers.get('X-AUTH-TOKEN'):
        if 'X-AUTH-TOKEN' in req.headers:
            tenant_id = kwargs.get('tenant_id',
                                   req.headers.get('X-AUTH-PROJECT-ID'))
            token_details = auth.get_token_details(req.headers['X-AUTH-TOKEN'],
                                                   tenant_id=tenant_id)

            client.auth = auth.get_auth(token_details)

            req.env['tenant_id'] = token_details['tenant_id']

    req.env['sl_client'] = client
dataset/ETHPy150Open softlayer/jumpgate/jumpgate/common/sl/__init__.py/hook_get_client/original