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 |
Instantiate a LinodeResponse from the HTTP response @keyword response: The raw response returned by urllib @return: parsed L{LinodeResponse}
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
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
Convert an API error to a LinodeException instance @keyword error: JSON object containing C{ERRORCODE} and C{ERRORMESSAGE} @type error: dict