Closed alexindaco closed 5 years ago
This is currently possible on the master branch:
>>> from smart_open import open
>>> import boto3
>>> s3 = boto3.resource('s3')
>>> summary = s3.ObjectSummary('commoncrawl', 'robots.txt')
>>> stream = summary.get()['Body']._raw_stream
>>> open(stream).read()
'User-Agent: *\nDisallow: /'
I don't think any further work is necessary here. @ceruly Can you please let me know if I've misunderstood something?
I noticed that for
boto.s3.key.Key
you useio.BufferedReader
.boto3's
botocore.response.StreamingBody
has the attribute_raw_stream
which it looks like you can just pass toio.BufferedReader
and it works.