Sven Hendriks is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

shendriks / JRPC

An experiment in creating a lightweight RPC lib that uses JSON and HTTP

Clone this repository (size: 7.9 KB): HTTPS / SSH
hg clone https://bitbucket.org/shendriks/jrpc
hg clone ssh://hg@bitbucket.org/shendriks/jrpc

JRPC overview

Recent commits See more »

Author Revision Comments Message Labels Date
Sven Hendriks dcb02f70eddc Updated README, unit tests and examples; Explicit conversion to int is no longer necessary
Sven Hendriks fa37d87f91ea Now using JSON for requests as well
Sven Hendriks ba547f7e915f serve() now expects^Cn object instead of a class
Sven Hendriks 375065fcfe10 Added README.rst
Sven Hendriks 6e54b3768c9b Added LICENSE

Server

Here's a snippet for the server side of things:

from jrpc.server import serve

# the class whose methods we're going to expose
class Handler(object):
        def sum(self, a, b):
                return a + b

serve(9000, Handler())

Client

And here's a snippet for the client:

from jrpc.client import JRPCClient

c = JRPCClient('localhost', 9000)
sum = c.sum(1, 2)