Reading an JSON file from S3 using Python boto3

前端 未结 5 939
灰色年华
灰色年华 2020-12-08 04:41

I kept following JSON in S3 bucket \'test\'

{
  \'Details\' : \"Something\" 
}

I am using following code to read this JSON and printing the

5条回答
  •  旧时难觅i
    2020-12-08 05:07

    Wanted to add that the botocore.response.streamingbody works well with json.load:

    import json
    import boto3
    
    s3 = boto3.resource('s3')
    
    obj = s3.Object(bucket, key)
    data = json.load(obj.get()['Body']) 
    

提交回复
热议问题