ezoic

Friday, May 19, 2017

Boto3 check if a s3 folder exists



https://github.com/boto/boto3/issues/134


import boto3
import botocore

client = boto3.client('s3')
result = client.list_objects(Bucket="spark", Prefix="temp/temp2/file3" )

exists=False
if result:
    exists=True

print exists


https://github.com/boto/botocore/issues/680







2 comments:

  1. if "Contents" in result:
    exist = True
    else:
    exist = False

    ReplyDelete
    Replies
    1. shouldn't be something like?:

      if not result["Contents"]:
      # Not exists
      else:
      # Exists

      Delete

looking for a man

 I am a mid aged woman.  I was born in 1980. I do not have any kid. no complicated  dating before . I am looking for a man here for marriage...