Skip to content

Commit

Permalink
Don't use s3 bucket_head to check for bucket existence
Browse files Browse the repository at this point in the history
This is about
piskvorky#314

This code caused problems when you have write permission to an s3
bucket path but not read permission to the bucket root.

This code was added to prevent implicit bucket creation (to fix issue
154) but it appears that it is no longer needed.
  • Loading branch information
toby cabot committed May 17, 2019
1 parent 2dc8d60 commit 85ad8a4
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions smart_open/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,6 @@ def __init__(
multipart_upload_kwargs = {}

s3 = session.resource('s3', **resource_kwargs)

#
# https://stackoverflow.com/questions/26871884/how-can-i-easily-determine-if-a-boto-3-s3-bucket-resource-exists
#
try:
s3.meta.client.head_bucket(Bucket=bucket)
except botocore.client.ClientError:
raise ValueError('the bucket %r does not exist, or is forbidden for access' % bucket)
self._object = s3.Object(bucket, key)
self._min_part_size = min_part_size
self._mp = self._object.initiate_multipart_upload(**multipart_upload_kwargs)
Expand Down

0 comments on commit 85ad8a4

Please sign in to comment.