I have list of files from S3 which I am reading using following. Here I have list of files(keys). I would like to further transfer these outputs to JSON files for each individual key from S3.
I am not finding the ideal way to do so. Could you recommend how I can achieve that.
import json
import boto3
from io import BytesIO
import gzip
try:
s3 = session.resource('s3')
key='00604T143000Z_20200604T143500Z.log.gz'
obj = s3.Object('my_bucket',key)
n = obj.get()['Body'].read()
gzipfile = BytesIO(n)
gzipfile = gzip.GzipFile(fileobj=gzipfile)
content = gzipfile.read()
print(content)
except Exception as e:
print(e)
raise e