Package s3 :: Module generator :: Class S3Generator
[hide private]
[frames] | no frames]

Class S3Generator

source code


Generator class

Objects of this class are used for generating authenticated URLs for accessing Amazon's S3 service.

Instance Methods [hide private]
  __init__(self, pub_key, priv_key, secure=True, host=s3.DEFAULT_HOST, port=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  set_expires_in(self, expires_in)
Set relative expiration time from the url creation moment.
  set_expires(self, expires)
Set absolute expiration time.
  make_bare_url(self, bucket, key='')
Make an unauthorised URL.
  _auth_header_value(self, method, path, headers)
  _headers(self, headers=None, length=None, expires=None)
  _params(self, params, acl=False)
  _path(self, bucket=None, key=None, acl=False)
  _io_len(self, io)
  _generate(self, method, bucket=None, key=None, send_io=None, params=None, headers=None, acl=False)
string create_bucket(self, name, headers={})
Create a bucket.
string list_bucket(self, name, params={}, headers={})
List a bucket's content.
string delete_bucket(self, name, headers={})
Delete a bucket.
string list_buckets(self, headers={})
List all buckets
  put(self, bucket, key, obj, headers={})
  get(self, bucket, key, headers={})
  delete(self, bucket, key, headers={})
string get_bucket_acl(self, name, headers={})
Get acl information for a bucket.
  get_acl(self, bucket, key=None, headers={})
Get acl information for an object.
  put_bucket_acl(self, name, acl_xml_document, headers={})
  put_acl(self, bucket, key, acl_xml_document, headers={})

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, pub_key, priv_key, secure=True, host=s3.DEFAULT_HOST, port=None)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

set_expires_in(self, expires_in)

source code 
Set relative expiration time from the url creation moment.
Parameters:
  • expires_in (int) - Relative expiration time

set_expires(self, expires)

source code 
Set absolute expiration time.
Parameters:
  • expires (time.time()) - Absolute expiration time

make_bare_url(self, bucket, key='')

source code 
Make an unauthorised URL.

_auth_header_value(self, method, path, headers)

source code 
None

_headers(self, headers=None, length=None, expires=None)

source code 
None

_params(self, params, acl=False)

source code 
None

_path(self, bucket=None, key=None, acl=False)

source code 
None

_io_len(self, io)

source code 
None

_generate(self, method, bucket=None, key=None, send_io=None, params=None, headers=None, acl=False)

source code 
None

create_bucket(self, name, headers={})

source code 
Create a bucket.
Parameters:
  • name (string) - Name for the new bucket
  • headers (dict) - Additional headers
Returns: string
Authenticated URL for creating a bucket

list_bucket(self, name, params={}, headers={})

source code 
List a bucket's content.
Parameters:
  • name (string) - Bucket's name
  • params (dict) - Additional parameters
  • headers (dict) - Additional headers
Returns: string
Authenticated URL for listing bucket's content

delete_bucket(self, name, headers={})

source code 
Delete a bucket.
Parameters:
  • name (string) - Name of the bucket that should be deleted
  • headers (dict) - Additional headers
Returns: string
Authenticated URL for delete a bucket

list_buckets(self, headers={})

source code 
List all buckets
Parameters:
  • headers (dict) - Additional headers
Returns: string
Authenticated URL for listing all buckets

put(self, bucket, key, obj, headers={})

source code 
None

get(self, bucket, key, headers={})

source code 
None

delete(self, bucket, key, headers={})

source code 
None

get_bucket_acl(self, name, headers={})

source code 
Get acl information for a bucket.
Parameters:
  • name (string) - Bucket name
  • headers (dict) - Additional headers
Returns: string
Authenticated URL for getting acl information for a bucket

get_acl(self, bucket, key=None, headers={})

source code 
Get acl information for an object.
Parameters:
  • bucket (string) - Bucket's name
  • key (string) - Object's name
  • headers (dict) - Additional headers
Returns:
Authenticated URL for getting acl information for an object

put_bucket_acl(self, name, acl_xml_document, headers={})

source code 
None

put_acl(self, bucket, key, acl_xml_document, headers={})

source code 
None