cyclone.jsonrpc — JSON-encoded Remote Procedure Call

Server-side implementation of the JSON-RPC protocol.

JSON-RPC is a lightweight remote procedure call protocol, designed to be simple.

For more information, check out the RPC demo.

class cyclone.jsonrpc.JsonrpcRequestHandler(application, request, **kwargs)[source]

Subclass this class and define jsonrpc_* to make a handler.

Example:

class MyRequestHandler(JsonrpcRequestHandler):
    def jsonrpc_echo(self, text):
        return text

    def jsonrpc_sort(self, items):
        return sorted(items)

    @defer.inlineCallbacks
    def jsonrpc_geoip_lookup(self, address):
        response = yield cyclone.httpclient.fetch(
            "http://freegeoip.net/json/%s" % address.encode("utf-8"))
        defer.returnValue(response.body)

Previous topic

cyclone.xmlrpc — XML-encoded Remote Procedure Call

Next topic

cyclone.websocket — Bidirectional communication to the browser

This Page