Files create, update, read, delete through AWS S3.
Bases: boto.s3.connection.S3Connection
AwsS3Tools
Parameters: |
---|
See also
validate in get_bucket in boto.s3.connection.S3Connection
Return type: | boto.s3.connection.S3Connection |
---|---|
Returns: | boto.s3.connection.S3Connection |
Connect bucket with filename:
>>> FILES = AwsS3Tools('toomore-aet', AWSID, AWSKEY, 'toomore.txt')
>>> print FILES
Connect bucket without filename but using open():
>>> FILES = AwsS3Tools('toomore-aet', AWSID, AWSKEY)
>>> FILES.open('toomore.txt')
Open a file by keyname
Parameters: | filename (str) – filename, the same with s3 object key name. |
---|
>>> FILES.open('toomore.txt')
Note
No return value, key object will put into self.keys
Read file from S3
Return type: | cStringIO.StringIO() |
---|
>>> content = FILES.read()
>>> print content.read()
Save file to S3
Parameters: | |
---|---|
Return type: | int |
Returns: | file size in byte. |
>>> with open('./README.md') as file_data:
... print FILES.save(file_data, True)
Update file.
Parameters: | file_data (file) – file data |
---|---|
Return type: | int |
Returns: | file size in byte. |
>>> content = FILES.read()
>>> print content.read()
>>> content.writelines('Toomore is Toomore')
>>> FILES.update(content)
>>> print FILES.read().getvalue()
Todo
update key with the same acl.