Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: fc027e5287
Fetching contributors…

Cannot retrieve contributors at this time

executable file 55 lines (43 sloc) 2.353 kB
"""
SoftLayer Object Storage python client.
See COPYING for license information
"""
from object_storage.client import Client
from object_storage.consts import __version__
def get_client(*args, **kwargs):
""" 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`
"""
return get_httplib2_client(*args, **kwargs)
def get_httplib2_client(username, password, auth_url=None, auth_token=None, **kwargs):
""" 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`
"""
from object_storage.transport.httplib2conn import AuthenticatedConnection, Authentication
auth = Authentication(username, password, auth_url=auth_url, auth_token=auth_token, **kwargs)
conn = AuthenticatedConnection(auth)
client = Client(username, password, connection=conn)
return client
def get_requests_client(username, password, auth_url=None, auth_token=None, **kwargs):
""" Returns an Object Storage client (using Requests) """
from object_storage.transport.requestsconn import AuthenticatedConnection, Authentication
auth = Authentication(username, password, auth_url=auth_url, auth_token=auth_token, **kwargs)
conn = AuthenticatedConnection(auth)
client = Client(username, password, connection=conn)
return client
def get_twisted_client(username, password, auth_url=None, auth_token=None, **kwargs):
""" Returns an Object Storage client (using Twisted) """
from object_storage.transport.twist import AuthenticatedConnection, Authentication
auth = Authentication(username, password, auth_url=auth_url, auth_token=auth_token, **kwargs)
conn = AuthenticatedConnection(auth)
client = Client(username, password, connection=conn)
d = conn.authenticate().addCallback(lambda r: client)
return d
Jump to Line
Something went wrong with that request. Please try again.