github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/greeter/srv/python/rpc_server.py (about) 1 from werkzeug.wrappers import Request, Response 2 from werkzeug.serving import run_simple 3 4 from jsonrpc import JSONRPCResponseManager, dispatcher 5 6 @Request.application 7 def application(request): 8 # Dispatcher is dictionary {<method_name>: callable} 9 dispatcher["Say.Hello"] = lambda s: "hello " + s["name"] 10 11 response = JSONRPCResponseManager.handle( 12 request.data, dispatcher) 13 return Response(response.json, mimetype='application/json') 14 15 16 if __name__ == '__main__': 17 run_simple('localhost', 4000, application)