libcloud.common.xmlrpc module
Base classes for working with xmlrpc APIs
- class libcloud.common.xmlrpc.ErrorCodeMixin[source]
Bases:
object
This is a helper for API’s that have a well defined collection of error codes that are easily parsed out of error messages. It acts as a factory: it finds the right exception for the error code, fetches any parameters it needs from the context and raises it.
- exceptions: Dict[str, Type[LibcloudError]] = {}
- class libcloud.common.xmlrpc.XMLRPCConnection(secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, retry_delay=None, backoff=None)[source]
Bases:
Connection
Connection class which can call XMLRPC based API’s.
This class uses the xmlrpclib marshalling and demarshalling code but uses the http transports provided by libcloud giving it better certificate validation and debugging helpers than the core client library.
- add_default_headers(headers)[source]
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- request(method_name, *args, **kwargs)[source]
Call a given method_name.
- Parameters:
method_name (
str
) – A method exposed by the xmlrpc endpoint that you are connecting to.args (
tuple
) – Arguments to invoke with method with.
- responseCls
alias of
XMLRPCResponse
- class libcloud.common.xmlrpc.XMLRPCResponse(response, connection)[source]
Bases:
ErrorCodeMixin
,Response
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- parse_body()[source]
Parse response body.
Override in a provider’s subclass.
- Returns:
Parsed body.
- Return type:
str