无法在bot3.client.get_batch_predictions()上使用json.loads

无法在bot3.client.get_batch_predictions()上使用json.loads,json,django,amazon-web-services,boto3,amazon-machine-learning,Json,Django,Amazon Web Services,Boto3,Amazon Machine Learning,我在尝试解析json响应时遇到以下错误 应为字符串或缓冲区 在我的Django模型中,我有以下内容: def get_batch_prediction(self): client = boto3.client('machinelearning', region_name=settings.region, aws_access_key_id=settings.aws_access_key_id, aws_secret_access_key=settings.aws_secret_acces

我在尝试解析json响应时遇到以下错误

应为字符串或缓冲区

在我的Django模型中,我有以下内容:

def get_batch_prediction(self):
    client = boto3.client('machinelearning', region_name=settings.region, aws_access_key_id=settings.aws_access_key_id, aws_secret_access_key=settings.aws_secret_access_key)
    return client.get_batch_prediction(
        BatchPredictionId=str(self.id)
        )
我就这样叫它

batch = BatchPrediction.objects.get(id=batch_id)
response = batch.get_batch_prediction()
response = json.loads(response)
我知道响应是
json
,所以我希望这会将其更改为字典,但是,我得到了上面的错误

发生了什么?

建议
get\u batch\u prediction
返回字典而不是字符串。您不应该使用
json.loads()