I have this:
with open('my_file', 'r') as f_in:
for i in f_in:
response = s3.head_bucket(Bucket='i')
print(response)
I expect to get bucket properties for those buckets that are in my_file but instead I get:
botocore.exceptions.ClientError: An error occurred (403) when calling the HeadBucket operation: Forbidden
If I just put one bucket name it also fails
If I hardcode the bucket name "(Bucket='my-bucketoweiruowi')", it works!
If I get rid of the for loop:
var = 'my-bucketoweiruow'
response = s3.head_bucket(Bucket='var')
... it fails with the same 403 error
I removed the '' like this:
with open('my_file', 'r') as f_in:
for i in f_in:
response = s3.head_bucket(Bucket=i)
print(response)
...but I get this other error:
botocore.exceptions.ClientError: An error occurred (400) when calling the HeadBucket operation: Bad Request".
I have 2 separate aws accounts with different buckets for testing. Same behavior.
Looks like when going into the loop it... breaks?
'
. – Lamanus