JSON-RPC Client

A simple JSON-RPC client using requests for the http connection.

The RPC protocol is built on http(s), with the body containing a json-encoded dictionary:

Request Object:

  • method (string) - Name of the method to be invoked.
  • params (dict) - Keyword arguments to the method.

Response Object:

  • result (object) - The returned result from the method. This is REQUIRED on success, and MUST NOT exist if there was an error.
  • error (object) - A description of the error, likely an Exception object. This is REQUIRED on error and MUST NOT exist on success.
class iceprod.core.jsonRPCclient.Client(timeout=60.0, address=None, backoff=True, **kwargs)[source]

Raw JSONRPC client object

open()[source]

Open the http session

close()[source]

Close the http session

request(methodname, kwargs)[source]

Send request to RPC Server

class iceprod.core.jsonRPCclient.JSONRPC(address=None, timeout=None, passkey=None, **kwargs)[source]

JSON-RPC client connection.

Call RPC functions as regular function calls.

Example:

rpc = JSONRPC('http://my.server/jsonrpc')
rpc.set_task_status(task_id,'waiting')

Start the JSONRPC Client.

stop()[source]

Stop the JSONRPC Client.

restart()[source]

Restart the JSONRPC Client.