#S3 using python-requests
AWS authentication for Amazon S3 for the wonderful pyhon requests library
- Tested with python 2.7 and python 3
- At the moment only S3 is supported
importrequestsfromawsauthimportS3AuthACCESS_KEY='ACCESSKEYXXXXXXXXXXXX'SECRET_KEY='AWSSECRETKEYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'url='http://mybuck.s3.amazonaws.com/file.txt's='Lola is sweet'# Creating a filer=requests.put(url, data=s, auth=S3Auth(ACCESS_KEY, SECRET_KEY))
# Downloading a filer=requests.get(url, auth=S3Auth(ACCESS_KEY, SECRET_KEY))
ifr.text=='Lola is sweet':
print"It works"# Removing a filer=requests.delete(url, auth=S3Auth(ACCESS_KEY, SECRET_KEY))Installing requests-aws is simple with pip:
$ pip install requests-aws