Module zes3t :: Class S3Client
[show private | hide private]
[frames | no frames]

Class S3Client


Amazon S3 AWS proxy client.

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPAPI.html

Method Summary
S3Client __init__(self, aws_access_key_id, aws_secret_access_key, url)
CopyObjectResult CopyObject(self, SourceBucket, SourceKey, DestinationBucket, DestinationKey, **kwargs)
Create a copy of an object.
CreateBucketResult CreateBucket(self, Bucket, **kwargs)
Create a bucket.
Status DeleteBucket(self, Bucket, **kwargs)
Delete a bucket.
Status DeleteObject(self, Bucket, Key)
Delete an object.
GetObjectResult GetObject(self, Bucket, Key, GetMetadata, GetData, **kwargs)
Basic operation for retrieving an object stored in Amazon S3.
file GetObjectAsFile(self, Bucket, Key, File, GetMetadata, GetData, **kwargs)
Retrieve an object stored in Amazon S3 and save it to a local file.
[Bucket] ListAllMyBuckets(self)
Get list of all buckets owned by the sender of the request.
[Content] ListBucket(self, Bucket, **kwargs)
Get information about some of the items in the bucket.
PutObjectInlineResult PutObject(self, Bucket, Key, Data, **kwargs)
Add an object to a bucket.
PubObjectInlineResult PutObjectAsFile(self, File, Bucket, Key, **kwargs)
Add an object to a bucket from a local file.
boolean _is_client_error(wf)
(Static method)
boolean _is_server_error(wf)
(Static method)
object _retry_soap(method, delay, timestamp, signature, **kwargs)
Retry a failed SOAP call.
str _signature(self, operation, timestamp)
Compute the HMAC signature string required for every SOAP request
object _soap(self, method_name, retry_faults, retry_delay, **kwargs)
Encapsulates a direct SOAP call.
str _timestamp(self)
Format current time in required ISO UTC format
str _to_str(o)
Coerce an S3 SOAP result object to a string. (Static method)

Class Variable Summary
str AWS_WSDL_URL = 'http://doc.s3.amazonaws.com/2006-03-01/A...

Instance Method Details

__init__(self, aws_access_key_id=None, aws_secret_access_key=None, url='http://doc.s3.amazonaws.com/2006-03-01/AmazonS3.wsdl')
(Constructor)

Parameters:
aws_access_key_id -
aws_secret_access_key -
url -
Returns:
S3Client

CopyObject(self, SourceBucket, SourceKey, DestinationBucket, DestinationKey, **kwargs)

Create a copy of an object.
Parameters:
SourceBucket -
SourceKey -
DestinationBucket -
DestinationKey -
Keyword Parameters:
MetadataDirective - 'COPY' (default) or 'REPLACE'
Metadata -
AccessControlList -
CopySourceIfMatch -
CopySourceIfNoneMatch -
CopySourceIfUnmodifiedSince -
CopySourceIfModifiedSince -
Returns:
CopyObjectResult
Raises:
S3Error -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPCopyObject.html

CreateBucket(self, Bucket, **kwargs)

Create a bucket.
Parameters:
Bucket -
Keyword Parameters:
AccessControlList -
           (type=AccessControlList)
Returns:
CreateBucketResult
Raises:
S3Error -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPCreateBucket.html

DeleteBucket(self, Bucket, **kwargs)

Delete a bucket.
Parameters:
Bucket -
Returns:
Status
Raises:
S3Error -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPDeleteBucket.html

DeleteObject(self, Bucket, Key)

Delete an object.
Parameters:
Bucket -
Key -
Returns:
Status
Raises:
S3Error -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPDeleteObject.html

GetObject(self, Bucket, Key, GetMetadata=True, GetData=True, **kwargs)

Basic operation for retrieving an object stored in Amazon S3. Currently only supports files 1 MiB or smaller!
Parameters:
Bucket -
Key -
GetMetadata -
           (type=boolean)
GetData -
           (type=boolean)
Keyword Parameters:
Credential -
Returns:
GetObjectResult
Raises:
S3Error -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPGetObject.html

GetObjectAsFile(self, Bucket, Key, File=None, GetMetadata=True, GetData=True, **kwargs)

Retrieve an object stored in Amazon S3 and save it to a local file. Note that if the specified local file already exists, it will be clobbered. Currently only supports files 1 MiB or smaller!
Parameters:
Bucket -
Key -
File - a file object or filename, Key will be used if not specified
GetMetadata -
           (type=boolean)
GetData -
           (type=boolean)
Keyword Parameters:
Credential -
Returns:
file
Raises:
S3Error -
IOError -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPGetObject.html

ListAllMyBuckets(self)

Get list of all buckets owned by the sender of the request.
Returns:
[Bucket]
Raises:
S3Error -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPListAllMyBuckets.html

ListBucket(self, Bucket, **kwargs)

Get information about some of the items in the bucket.
Parameters:
Bucket -
Keyword Parameters:
Prefix -
Marker -
MaxKeys -
           (type=int)
Delimiter -
Credential -
Returns:
[Content]
Raises:
S3Error -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPListBucket.html

PutObject(self, Bucket, Key, Data, **kwargs)

Add an object to a bucket. Currently only supports files 1 MiB or smaller!
Parameters:
Bucket -
Key -
Data - byte str
Keyword Parameters:
Metadata -
AccessControlList -
Returns:
PutObjectInlineResult
Raises:
S3Error -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPPutObjectInline.html

PutObjectAsFile(self, File, Bucket, Key=None, **kwargs)

Add an object to a bucket from a local file. Currently only supports files 1 MiB or smaller!
Parameters:
File -
Bucket -
Key -
Keyword Parameters:
Metadata -
AccessControlList -
Returns:
PubObjectInlineResult
Raises:
S3Error -

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPPutObjectInline.html

_retry_soap(method, delay, timestamp, signature, **kwargs)

Retry a failed SOAP call.
Returns:
object
Raises:
S3ClientError -
S3ServerError -

_signature(self, operation, timestamp)

Compute the HMAC signature string required for every SOAP request
Returns:
str

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPAuthentication.html

_soap(self, method_name, retry_faults=True, retry_delay=0.5, **kwargs)

Encapsulates a direct SOAP call. All parameters should be passed in as kwargs. The AWS boilerplate params will be calculated and added automatically. Can optionally retry calls that fail due to server error.
Parameters:
method_name - Name of the SOAP method to call
retry_faults - Optionally retry calls on server-side error
retry_delay - Delay in seconds to wait before retry
Returns:
object
Raises:
S3ClientError -
S3ServerError -

_timestamp(self)

Format current time in required ISO UTC format
Returns:
str

See Also: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/SOAPAuthentication.html


Static Method Details

_is_client_error(wf)

Parameters:
wf
           (type=suds.WebFault)
Returns:
boolean

_is_server_error(wf)

Parameters:
wf
           (type=suds.WebFault)
Returns:
boolean

_to_str(o)

Coerce an S3 SOAP result object to a string.
Returns:
str

Class Variable Details

AWS_WSDL_URL

Type:
str
Value:
'http://doc.s3.amazonaws.com/2006-03-01/AmazonS3.wsdl'                 

Generated by Epydoc 2.1 on Tue Dec 9 18:32:17 2008 http://epydoc.sf.net