StorageObject

class object_storage.storage_object.StorageObject(container, name, headers=None, client=None)[source]

Representation of a Object Storage object.

constructor for StorageObject

@param container: container name @param name: object name @param headers: init headers to use when initializing the object @param client: object_storage.client instance.

exists()[source]

Tries to load the object to check existance

@raises ResponseError @return: boolean, true if exists else false

load(cdn=True)[source]

load data for the object

@param cdn: True if you want CDN information; default=True @return: object_storage.storage_object, self

get_info()[source]

loads data if not already available and returns the properties

properties[source]

loads data if not already available and returns the properties

props

loads data if not already available and returns the properties

headers[source]

loads data if not already available and returns the raw headers for the object

meta[source]

loads data if not already available and returns the metadata for the object

url[source]

Get the URL of the object

path[source]

Get the path of the object

list(limit=None, marker=None)[source]

Uses sudo-hierarchical structure to list the children objects.

@param limit: limit of results to return. @param marker: start listing after this object name @raises ResponseError @return: list of StorageObject instances

is_dir()[source]

returns True if content_type is ‘text/directory’

set_metadata(meta)[source]

Sets metadata for the object

@param meta: dict of metadata on the object @raises ResponseError

create()[source]

Create object

@raises ResponseError @return: StorageObject - self

delete(recursive=False)[source]

Delete object

@raises ResponseError @return: True

read(size=0, offset=0)[source]

Reads object content

@param size: number of bytes to read (0 reads all of the object data) @param offset: number of bytes to offset the read @raises ResponseError @return: str, data

save_to_filename(filename)[source]

Reads object content into a file

@param filename: filename @raises ResponseError

chunk_download(chunk_size=None)[source]

Returns an iterator to read the object data.

@param chunk_size: size of the chunks to read in.
If not defined uses self.chunk_size

@raises: ResponseError @return: iterable

iter_content(chunk_size=None)

Returns an iterator to read the object data.

@param chunk_size: size of the chunks to read in.
If not defined uses self.chunk_size

@raises: ResponseError @return: iterable

chunk_upload(headers=None)[source]
Returns a chunkable upload instance.
This is needed for transient data uploads

@param headers: extra headers to use to initialize the request @raises: ResponseError @return: object that responds to o.send(‘data’) to send data

and o.finish() to finish the upload.
send(data)[source]

Uploads object data

@param data: either a file-like object or a string. @raises: ResponseError @return: StorageObject, self

write(data)

Uploads object data

@param data: either a file-like object or a string. @raises: ResponseError @return: StorageObject, self

upload_directory(directory)[source]

Uploads an entire directory

@param directory: path of the directory to upload @raises: ResponseError

load_from_filename(filename)[source]

Uploads a file from the local filename

@param filename: path of the directory to upload @raises: ResponseError, IOError

copy_from(old_obj, *args, **kwargs)[source]

Copies content from an existing object

@param old_obj: StorageObject instance to copy data from @raises: ResponseError @return: StorageObject, self

copy_to(new_obj, *args, **kwargs)[source]

Copies content from an existing object

@param new_obj: StorageObject instance to copy data to @raises: ResponseError @return: StorageObject, new_obj

rename(new_obj, *args, **kwargs)[source]

Copies content to a new object existing object and deletes the current object

@param new_obj: StorageObject instance to copy data to @raises: ResponseError

search(q, options=None, **kwargs)[source]

Search within path

prime_cdn()[source]

Prime the object for CDN usage

purge_cdn()[source]

Purge the object for CDN usage

make_request(method, path=None, *args, **kwargs)[source]

returns a request object

fileno()[source]

Previous topic

Container

This Page