l.c.b.Connection(object) : class documentation

Part of libcloud.common.base View Source View In Hierarchy

Known subclasses: libcloud.common.base.PollingConnection, libcloud.compute.base.ConnectionKey

A Base Connection class to derive from.
Method __init__ Undocumented
Method set_context Undocumented
Method connect Establish a connection with the API server.
Method user_agent_append Append a token to a user agent string.
Method request Request a given `action`.
Method morph_action_hook Undocumented
Method add_default_params Adds default parameters (such as API key, version, etc.) to the passed `params`
Method add_default_headers Adds default headers (such as Authorization, X-Foo-Bar) to the passed `headers`
Method pre_connect_hook A hook which is called before connecting to the remote server. This hook can perform a final manipulation on the params, headers and url parameters.
Method encode_data Encode body data.
Method _tuple_from_url Undocumented
Method _user_agent Undocumented
def __init__(self, secure=True, host=None, port=None, url=None, timeout=None): (source)
Undocumented
def set_context(self, context): (source)
Undocumented
def _tuple_from_url(self, url): (source)
Undocumented
def connect(self, host=None, port=None, base_url=None): (source)
Establish a connection with the API server.

@type host: C{str}
@param host: Optional host to override our default

@type port: C{int}
@param port: Optional port to override our default

@returns: A connection
def _user_agent(self): (source)
Undocumented
def user_agent_append(self, token): (source)
Append a token to a user agent string.

Users of the library should call this to uniquely identify thier
requests to a provider.

@type token: C{str}
@param token: Token to add to the user agent.
def request(self, action, params=None, data='', headers=None, method='GET', raw=False): (source)
Request a given `action`.

Basically a wrapper around the connection
object's `request` that does some helpful pre-processing.

@type action: C{str}
@param action: A path

@type params: C{dict}
@param params: Optional mapping of additional parameters to send. If
    None, leave as an empty C{dict}.

@type data: C{unicode}
@param data: A body of data to send with the request.

@type headers: C{dict}
@param headers: Extra headers to add to the request
    None, leave as an empty C{dict}.

@type method: C{str}
@param method: An HTTP method such as "GET" or "POST".

@type raw: C{bool}
@param raw: True to perform a "raw" request aka only send the headers
             and use the rawResponseCls class. This is used with
             storage API when uploading a file.

@return: An instance of type I{responseCls}
def morph_action_hook(self, action): (source)
Undocumented
def add_default_params(self, params): (source)
Adds default parameters (such as API key, version, etc.)
to the passed `params`

Should return a dictionary.
def add_default_headers(self, headers): (source)
Adds default headers (such as Authorization, X-Foo-Bar)
to the passed `headers`

Should return a dictionary.
def pre_connect_hook(self, params, headers): (source)
A hook which is called before connecting to the remote server.
This hook can perform a final manipulation on the params, headers and
url parameters.

@type params: C{dict}
@param params: Request parameters.

@type headers: C{dict}
@param headers: Request headers.
def encode_data(self, data): (source)
Encode body data.

Override in a provider's subclass.
API Documentation for libcloud, generated by pydoctor at 2012-11-19 11:53:43.