Reputation: 1069
What is the easy way to making json rpc call from python?
Upvotes: 7
Views: 17022
Reputation: 3655
you need to create server and client script. and you have to provide JSONRPCResponseManager and dispatcher.
from jsonrpc import JSONRPCResponseManager, dispatcher
something like @Request.application def application(request): # Dispatcher is dictionary {: callable} dispatcher["Hi"] = lambda s: s
response = JSONRPCResponseManager.handle(
request.data, dispatcher)
return Response(response.json, mimetype='application/json')
Upvotes: 0
Reputation: 124
Also there is json-rpc library, it supports python2.7, python3.2+, does not have dependencies and it`s protocol independent.
Upvotes: 2
Reputation: 725
json-wsp (implemented in Ladon) has a python client and a javascript client for browsers.
Ladon (Supports both python 2 and 3)
Python client (Python client can be used from shell too)
Upvotes: 1