

def check_response(self, response, success=range(200, 207), key=None):
    if isinstance(response, Response):
        if (response.status_code in self):
            try:
                r = json.loads(response.text)
                return (r if (key is None) else r[key])
            except:
                _log.debug("Failed to parse response '{}' as json".format(response.text))
                return None
        raise Exception(('%d%s' % (response.status_code, (('\n' + response.text) if response.text else ''))))
    else:
        response._calvin_key = key
        response._calvin_success = success
        self.future_responses.append(response)
        return response

dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/requests/request_handler.py RequestHandler.check_response/VarMisuse@41/45 `success`->`self`