Skip to content

Instantly share code, notes, and snippets.

@krdlab
Last active December 25, 2018 06:31
Show Gist options
  • Save krdlab/05bbe7e3037242ed488d209c475c75b6 to your computer and use it in GitHub Desktop.
Save krdlab/05bbe7e3037242ed488d209c475c75b6 to your computer and use it in GitHub Desktop.
Python boto3 の S3 Client サンプル
import boto3
from botocore.exceptions import ClientError
client = boto3.client('s3')
try:
client.get_bucket_cors(Bucket='unknown-bucket')
except ClientError as e:
print e
try:
client.get_bucket_cors(Bucket='no-cors-config-bucket')
except ClientError as e:
print e
@krdlab
Copy link
Author

krdlab commented Dec 25, 2018

An error occurred (NoSuchBucket) when calling the GetBucketCors operation: The specified bucket does not exist
An error occurred (NoSuchCORSConfiguration) when calling the GetBucketCors operation: The CORS configuration does not exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment