l.c.l.LinodeResponse(JsonResponse) : class documentation

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

Known subclasses: libcloud.dns.drivers.linode.LinodeDNSResponse

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

Inherited from Response (via JsonResponse):

Method parse_error Parse the error messages.
Method _decompress_response Decompress a response body if it is using deflate or gzip encoding.
def __init__(self, response, connection): (source)
Instantiate a LinodeResponse from the HTTP response

@keyword response: The raw response returned by urllib
@return: parsed L{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.

@return: C{list} of objects and C{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.

@return: C{bool} indicating a successful request
def _make_excp(self, error): (source)
Convert an API error to a LinodeException instance

@keyword error: JSON object containing C{ERRORCODE} and C{ERRORMESSAGE}
@type error: dict
API Documentation for libcloud, generated by pydoctor at 2013-07-01 17:02:02.