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
def get_twisted_client(username, password, auth_url=None, auth_token=None, **kwargs): """ Returns an Object Storage client (using Twisted) """ from object_storage.client import Client 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
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.client import 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, config=None, **kwargs): """ Returns an Object Storage client (using Requests) """ from object_storage.client import Client from object_storage.transport.requestsconn import AuthenticatedConnection, Authentication auth = Authentication(username, password, auth_url=auth_url, auth_token=auth_token, **kwargs) conn = AuthenticatedConnection(auth, config=config) client = Client(username, password, connection=conn) return client