Home | Trees | Indices | Help |
|
---|
|
Storage data representing an object, (metadata and data).
Instance Methods | |||
|
|||
str or None |
|
||
|
|||
str generator |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
str |
|
||
str |
|
||
str |
|
||
|
|||
Inherited from |
Instance Variables | |
Container |
container the object's container (generally treat as read-only) |
str |
content_type the object's content-type (set or read) |
str |
last_modified date and time of last file modification (cached) |
dict |
metadata metadata associated with the object (set or read) |
str |
name the object's name (generally treat as read-only) |
number |
size the object's size (cached) |
Properties | |
objsum | |
etag | |
Inherited from |
Method Details |
Storage objects rarely if ever need to be instantiated directly by the user. Instead, use the create_object, get_object, list_objects and other methods on its parent Container object.
|
Read the content from the remote storage object. By default this method will buffer the response in memory and return it as a string. However, if a file-like object is passed in using the buffer keyword, the response will be written to it instead. A callback can be passed in for reporting on the progress of the download. The callback should accept two integers, the first will be for the amount of data written so far, the second for the total size of the transfer. Note: This option is only applicable when used in conjunction with the buffer option. >>> test_object.write('hello') >>> test_object.read() 'hello'
|
Save the contents of the object to filename. >>> container = connection['container1'] >>> obj = container.get_object('backup_file') >>> obj.save_to_filename('./backup_file')
|
Return a generator of the remote storage object's data. Warning: The HTTP response is only complete after this generator has raised a StopIteration. No other methods can be called until this has occurred. >>> test_object.write('hello') >>> test_object.stream() <generator object at 0xb77939cc> >>> '-'.join(test_object.stream(chunksize=1)) 'h-e-l-l-o'
|
Commits the metadata and custom headers to the remote storage system. >>> test_object = container['paradise_lost.pdf'] >>> test_object.metadata = {'author': 'John Milton'} >>> test_object.headers = {'content-disposition': 'foo'} >>> test_objectt.sync_metadata() Object metadata can be set and retrieved through the object's .metadata attribute.
|
Commits the manifest to the remote storage system. >>> test_object = container['paradise_lost.pdf'] >>> test_object.manifest = 'container/prefix' >>> test_object.sync_manifest() Object manifests can be set and retrieved through the object's .manifest attribute.
|
Write data to the remote storage system. By default, server-side verification is enabled, (verify=True), and end-to-end verification is performed using an md5 checksum. When verification is disabled, (verify=False), the etag attribute will be set to the value returned by the server, not one calculated locally. When disabling verification, there is no guarantee that what you think was uploaded matches what was actually stored. Use this optional carefully. You have been warned. A callback can be passed in for reporting on the progress of the upload. The callback should accept two integers, the first will be for the amount of data written so far, the second for the total size of the transfer. >>> test_object = container.create_object('file.txt') >>> test_object.content_type = 'text/plain' >>> fp = open('./file.txt') >>> test_object.write(fp)
|
Copy an object's contents to another location.
|
Copy another object's contents to this object.
|
Write potentially transient data to the remote storage system using a generator or stream. If the object's size is not set, chunked transfer encoding will be used to upload the file. If the object's size attribute is set, it will be used as the Content-Length. If the generator raises StopIteration prior to yielding the right number of bytes, an IncompleteSend exception is raised. If the content_type attribute is not set then a value of application/octet-stream will be used. Server-side verification will be performed if an md5 checksum is assigned to the etag property before calling this method, otherwise no verification will be performed, (verification can be performed afterward though by using the etag attribute which is set to the value returned by the server). >>> test_object = container.create_object('backup.tar.gz') >>> pfd = os.popen('tar -czvf - ./data/', 'r') >>> test_object.send(pfd)
|
Put the contents of the named file into remote storage. >>> test_object = container.create_object('file.txt') >>> test_object.content_type = 'text/plain' >>> test_object.load_from_filename('./my_file.txt')
|
str(x)
|
Retrieve the URI for this object, if its container is public. >>> container1 = connection['container1'] >>> container1.make_public() >>> container1.create_object('file.txt').write('testing') >>> container1['file.txt'].public_uri() 'http://c00061.cdn.cloudfiles.rackspacecloud.com/file.txt'
|
Retrieve the SSL URI for this object, if its container is public. >>> container1 = connection['container1'] >>> container1.make_public() >>> container1.create_object('file.txt').write('testing') >>> container1['file.txt'].public_ssl_uri() 'https://c61.ssl.cf0.rackcdn.com/file.txt'
|
Retrieve the streaming URI for this object, if its container is public. >>> container1 = connection['container1'] >>> container1.make_public() >>> container1.create_object('file.txt').write('testing') >>> container1['file.txt'].public_streaming_uri() 'https://c61.stream.rackcdn.com/file.txt'
|
Purge Edge cache for this object. You will be notified by email if one is provided when the job completes. >>> obj.purge_from_cdn("user@dmain.com") or >>> obj.purge_from_cdn("user@domain.com,user2@domain.com") or
>>> obj.purge_from_cdn()
|
Property Details |
objsum
|
etag
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Jun 1 13:14:21 2012 | http://epydoc.sourceforge.net |