framework-independent library for serving JSON-RPC from Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
examples
simplejsonrpc
.gitignore
LICENSE.txt
MANIFEST.in
README.rst
setup.py

README.rst

simplejsonrpc

Author: Hunter Blanks
Contact: hblanks@artifex.org
Date: 2012-01-11
Copyright: This document has been placed in the public domain.
URL:http://github.com/hblanks/simplejsonrpc/

Introduction

simplejsonrpc is a small library for handling JSON-RPC requests over HTTP. Three nice features are:

  1. Simplicity. This library is easy to use with any web framework, and it won't get in the way of any existing authentication or tenancy code you might already have.
  2. Full compliance with the JSON-RPC 2.0, except for batch requests -- so invalid requests get the appropriate status code & error response.
  3. A handy, builtin client, simplejsonrpc.client, is included, too.

Getting started

This package installs with setuptools:

easy_install simplejsonrpc/

The examples/ directory has examples for how to use simplejsonrpc. For instance, to try out a cherrypy server, you could do:

python examples/cherrypy.py &

To start your server, and then do:

echo "multiply(2, 8)" | python -m simplejsonrpc.client http://127.0.0.1:8080/

to send a JSON-RPC requset to it.

You can also use the JSON-RPC client from a command prompt, like so:

python -m simplejsonrpc.client http://127.0.0.1:8080/
jsonrpc> multiply(2, 8)
--> {"params": [2, 8], "jsonrpc": "2.0", "id": 1, "method": "multiply"}
16

Feedback, comments, and fixes

For feedback or fixes, please refer to the public page for this library at:

http://github.com/hblanks/simplejsonrpc