Open S3 object as a string with Boto3

前端 未结 5 1200
故里飘歌
故里飘歌 2020-12-02 06:13

I\'m aware that with Boto 2 it\'s possible to open an S3 object as a string with: get_contents_as_string()

Is there an equivalent function in boto3 ?

5条回答
  •  北海茫月
    2020-12-02 06:42

    This isn't in the boto3 documentation. This worked for me:

    object.get()["Body"].read()
    

    object being an s3 object: http://boto3.readthedocs.org/en/latest/reference/services/s3.html#object

提交回复
热议问题