Version 1 (modified by Sung-jin Hong, 17 years ago) ( diff )

--

Simply see [XML-RPC]. Use the SimpleJSONRPCServer instead of SimpleXMLRPCServer and you are done!

You'll also want JSON RPC Client too.

$ cat testjsonrpc.py 
import sys
import jsonrpclib
rpc_srv = jsonrpclib.ServerProxy("http://localhost:8000/json_rpc_srv/")
result = rpc_srv.multiply( int(sys.argv[1]), int(sys.argv[2]))
print "%d * %d = %d" % (int(sys.argv[1]), int(sys.argv[2]), result['result'])

There you go!

Another power of python here!

Note: See TracWiki for help on using the wiki.
Back to Top