

def _response_parser(self, r, expect_json=True, ignore_content=False):
    '\n        :param :class:`requests.Response` r: a response object of the Requests\n            library\n        :param bool expect_json: if True, raise :class:`.InvalidAPIAccess` if\n            response is not in JSON format\n        :param bool ignore_content: whether to ignore setting content of the\n            Response object\n        '
    if r.ok:
        try:
            j = r.json()
            return Response(res.get('state'), j)
        except ValueError:
            if expect_json:
                logger = logging.getLogger(conf.LOGGING_API_LOGGER)
                logger.debug(r.text)
                raise InvalidAPIAccess('Invalid API access.')
            if ignore_content:
                res = Response(True, None)
            else:
                res = Response(True, r.text)
            return res
    else:
        r.raise_for_status()

dataset/ETHPy150Open shichao-an/115wangpan/u115/api.py RequestHandler._response_parser/VarMisuse@44/164 `j`->`res`