12

So when I issue a get() what I have is a dict and the 'Body' member of the dict is a "StreamingBody' type and per How to save S3 object to a file using boto3, I see how I could read from this stream in chunks, but I'm wondering if there's an easier way to do this, a la boto.

TerminalDilettante
  • 595
  • 1
  • 6
  • 24
  • 1
    Update: I have done ` response = s3_client.get_object(Bucket=bn,Key=obj['Key']) contents = response['Body'].read() ` which seems to work. – TerminalDilettante Sep 11 '15 at 15:12

1 Answers1

21

Update: I have done

response = s3_client.get_object(Bucket=bn,Key=obj['Key'])
contents = response['Body'].read()

which seems to work.

jkdev
  • 11,360
  • 15
  • 54
  • 77
TerminalDilettante
  • 595
  • 1
  • 6
  • 24
  • 2
    assuming "Body" contains string data, ou can use object.get()["Body"].read() to convert to a Python string – roehrijn Nov 24 '15 at 13:00