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
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:48:28.