Skip to content

Commit aaf136a

Browse files
authored
Merge branch 'master' into aws_exception_data
2 parents a1026f2 + 3059948 commit aaf136a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/example_code/s3/create_bucket.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ def create_bucket(bucket_name, region=None):
3939
"""
4040

4141
# Create bucket
42-
s3_client = boto3.client('s3')
4342
try:
4443
if region is None:
44+
s3_client = boto3.client('s3')
4545
s3_client.create_bucket(Bucket=bucket_name)
4646
else:
47+
s3_client = boto3.client('s3', region_name=region)
4748
location = {'LocationConstraint': region}
4849
s3_client.create_bucket(Bucket=bucket_name,
4950
CreateBucketConfiguration=location)

0 commit comments

Comments
 (0)