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 againJRPC overview
Recent commits See more »
| Author | Revision | Comments | Message | Labels | Date |
|---|---|---|---|---|---|
|
|
dcb02f70eddc |
Updated README, unit tests and examples; Explicit conversion to int is no longer necessary |
|
||
|
|
fa37d87f91ea |
Now using JSON for requests as well |
|
||
|
|
ba547f7e915f |
serve() now expects^Cn object instead of a class |
|
||
|
|
375065fcfe10 |
Added README.rst |
|
||
|
|
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)