def extractSuccessfulJSONResult(response):
    result = readBody(response)
    result.addCallback(loads)

    def getResult(data):
        if response.code > 299:
            raise AssertionError((response.code, data))
        return data
    result.addCallback(getResult)
    return result
Extract a successful API result from a HTTP response.
dataset/ETHPy150Open ClusterHQ/flocker/flocker/restapi/testtools.py/extractSuccessfulJSONResult