l.c.d.l.LinodeResponse(Response) : class documentation

Part of libcloud.compute.drivers.linode View Source View In Hierarchy

Linode API response

Wraps the HTTP response returned by the Linode API, which should be JSON in
this structure:

   {
     "ERRORARRAY": [ ... ],
     "DATA": [ ... ],
     "ACTION": " ... "
   }

libcloud does not take advantage of batching, so a response will always
reflect the above format.  A few weird quirks are caught here as well.
Method __init__ Instantiate a LinodeResponse from the HTTP response
Method parse_body Parse the body of the response into JSON objects
Method success Check the response for success
Method _make_excp Convert an API error to a LinodeException instance
def __init__(self, response): (source)
Instantiate a LinodeResponse from the HTTP response
ParametersresponseThe raw response returned by urllib
Returnsparsed LinodeResponse
def parse_body(self): (source)
Parse the body of the response into JSON objects

If the response chokes the parser, action and data will be returned as None and errorarray will indicate an invalid JSON exception.

Returnslist of objects and list of errors
def success(self): (source)
Check the response for success

The way we determine success is by the presence of an error in ERRORARRAY. If one is there, we assume the whole request failed.

Returnsbool indicating a successful request
def _make_excp(self, error): (source)
Convert an API error to a LinodeException instance
ParameterserrorJSON object containing ERRORCODE and ERRORMESSAGE (type: dict)
API Documentation for libcloud, generated by pydoctor at 2012-07-15 18:45:14.