Client

SoftLayer Object Storage python client.

See COPYING for license information

object_storage.get_client(*args, **kwargs)[source]

Returns an Object Storage client (using httplib2)

@param username: username for Object Storage @param password: password or api key for Object Storage @param auth_url: Auth URL for Object Storage @param auth_token: If provided, bypasses authentication and uses the given auth_token @return: object_storage.client.Client

object_storage.get_httplib2_client(username, password, auth_url=None, auth_token=None, **kwargs)[source]

Returns an Object Storage client (using httplib2)

@param username: username for Object Storage @param password: password or api key for Object Storage @param auth_url: Auth URL for Object Storage @param auth_token: If provided, bypasses authentication and uses the given auth_token @return: object_storage.client.Client

object_storage.get_requests_client(username, password, auth_url=None, auth_token=None, **kwargs)[source]

Returns an Object Storage client (using Requests)

object_storage.get_twisted_client(username, password, auth_url=None, auth_token=None, **kwargs)[source]

Returns an Object Storage client (using Twisted)


class object_storage.client.Client(username=None, api_key=None, connection=None, delimiter='/', **kwargs)[source]

Client class. Primary interface for the client.

constructor for Client object

@param username: the username @param api_key: api_key for Object Storage @param connection: object_storage.transport.AuthenticatedConnection

instance.
@param delimiter: the symbol to use to divid up hiearchical divisions
for objects.

@param container_class: factory or class for Container constructing @param object_class: factory or class for StorageObject constructing

load()[source]

load data for the account

@return: object_storage.client, 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 account

meta[source]

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

path[source]

Returns the file-path. Always returns an empty string.

url[source]

Returns the url of the resource.

is_dir()[source]

Returns whether or not this is a directory. Always True.

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

Access the search interface. @param q: the search query. This can be None. @param options: options for the search API. Valid options:

q.[fieldname] -> define search query for a specific field. field -> field name (when using q) type -> ‘object’ or ‘container’; default shows both. recursive -> whether to search recursively or to limit to

one level; default=true
@param **kwargs: to be merged into the options param.
Provides a nicer interface for the same thing.
More information on options:
http://sldn.softlayer.com/article/API-Operations-Search-Services
set_delimiter(delimiter)[source]

Sets the delimiter for pseudo hierarchical directory structure. @param delimiter: delimiter to use

set_storage_url(url)[source]

Sets the storage URL. After authentication, the URL is automatically populated, but the default value can be overwritten.

@param url: url to use to call the Object Storage API.

container(name, headers=None)[source]

Initializes container object.

@param name: name of the container @param headers: initial headers to use to initialize the object

get_container(name)[source]

Makes a container object and calls load() on it. @param name: container name @raises ResponseError

set_metadata(meta, headers={})[source]

Sets metadata for the account

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

create_container(name)[source]

Creates a new container

@param name: container name @raises ResponseError

delete_container(name, recursive=False)[source]

Deletes a container.

@param name: container name @raises ResponseError @raises ContainerNotEmpty if container is not empty

containers(marker=None, headers=None)[source]

Lists containers

@param marker: start listing after this container name @param headers: extra headers to use when making the listing call @raises ResponseError

public_containers(*args, **kwargs)[source]

Lists public containers. Same interface as self.containers()

@raises ResponseError

storage_object(container, name, headers=None)[source]

Initialize a StorageObject instance

@param container: container name @param name: object name @param headers: initial headers to use to initialize the object

get_object(container, name)[source]

Load an object from swift

@param container: container name @param name: object name @raises ResponseError

delete_object(container, name)[source]

Delete an object from swift

@param container: container name @param name: object name @raises ResponseError

get_url(path=None)[source]

Returns the url of the resource

@param path: path to append to the end of the URL

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

Make an HTTP request

@param method: HTTP method (GET, HEAD, POST, PUT, ...) @param path: path @raises ResponseError

chunk_download(path, chunk_size=10240, headers=None)[source]

Returns a chunk download generator

@param path: path @param chunk_size: the max size in bytes to return on each yield @param headers: extra headers to use with this request @raises ResponseError

chunk_upload(path, headers=None)[source]

Returns a chunkable connection object at the given path

@param path: path @param headers: extra headers to use with this request @raises ResponseError

Previous topic

SoftLayer Object Storage (Python binding)

Next topic

Container

This Page