Download File/folder From Public AWS S3 With Python, No Credentials
I have opened a public access to S3 bucket and I need to download files / folders with files from the bucket using python. The trick is that I do not want to supply credentials (wh
Solution 1:
You can use GetObject from the S3 REST API, together with the Requests library in Python. If you grant READ access to the anonymous user, you can return the object without using an authorization header.
Example of a such a S3 REST call::
> GET /example-object HTTP/1.1
> Host: example-bucket.s3.<Region>.amazonaws.com
Python(rough example):
import requests
url = '/example-object'
headers = {'Host': 'example-bucket.s3.<Region>.amazonaws.com'}
r = requests.get(url, headers=headers)
Post a Comment for "Download File/folder From Public AWS S3 With Python, No Credentials"