I want to download an image from a bucket S3 and store in a variable, not in my local pc, how can I do it?
I'm using this code to store in local:
BUCKET_NAME = 'mybucket'
KEYFILE = 'myImage.jpg'
try:
s3.Bucket(BUCKET_NAME).download_file(KEYFILE, 'myImageInLocal.jpg')
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] == "404":
print("The object does not exist.")
else:
raise