It would be nice having the ability to write multiple zip-entries (meaning, multiple source files) to the target zip file. Something like this:
```python
s3_objects = client.list_objects(Bucket=bucket, Delimiter='/', Prefix=key)
with open('s3://my_bucket/my-file.zip', 'w') as fout:
for s3_object in s3_objects.get('Contents'):
s3_object = s3.Object(bucket, s3_object.get('Key'))
fout.write(s3_object.get('Key'), s3_object.get()['Body'].read().decode('utf-8'))
````
Is this something to be considered?
Archives are not supported by smart_open -- see previous discussion in #134 and #205, and especially this comment for a better solution: https://github.com/RaRe-Technologies/smart_open/pull/205#issuecomment-419821951
I've thought about it, but I think it's out of scope for this library. You could probably achieve what you want by using smart_open in combinaton with the zipfile module of the standard library:
import zipfile
with open('s3://my_bucket/my-file.zip', 'w') as fout:
with zipfile.ZipFile(fout) as foutz:
for data in data_list:
...
Thanks for the directions @piskvorky and @mpenkov
Most helpful comment
Archives are not supported by
smart_open-- see previous discussion in #134 and #205, and especially this comment for a better solution: https://github.com/RaRe-Technologies/smart_open/pull/205#issuecomment-419821951