def json_request(self, method, url, content_type='application/json',
                     **kwargs):
        kwargs.setdefault('headers', {})
        kwargs['headers'].setdefault('Content-Type', content_type)
        # Don't set Accept because we aren't always dealing in JSON

        if 'body' in kwargs:
            if 'data' in kwargs:
                raise ValueError("Can't provide both 'data' and "
                                 "'body' to a request")
            LOG.warning("Use of 'body' is deprecated; use 'data' instead")
            kwargs['data'] = kwargs.pop('body')
        if 'data' in kwargs:
            kwargs['data'] = jsonutils.dumps(kwargs['data'])

        resp = self._http_request(url, method, **kwargs)
        body = resp.content

        if 'application/json' in resp.headers.get('content-type', []):
            try:
                body = resp.json()
            except __HOLE__:
                LOG.error('Could not decode response body as JSON')
        else:
            body = None

        return resp, body
dataset/ETHPy150Open openstack/python-sticksclient/sticksclient/common/http.py/HTTPClient.json_request