refer to source code
..
import boto3
import botocore
ACCESS_KEY = '**'
SECRET_KEY = '**'
s3_client = boto3.client(
's3',
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY,
region_name = 'eu-west-1'
)
bucket_name = '***'
folder_name = '***'
#check folder exist
try:
result = s3_client.list_objects_v2(Bucket=bucket_name, Prefix=folder_name )
for o in result['Contents']:
print(o['Key']) #file list in folder
except botocore.exceptions.ClientError as e:
print('no folder exist')
..
Thank you
www.marearts.com
No comments:
Post a Comment