MCPcopy Create free account
hub / github.com/dabeaz/python-cookbook / RPCProxy

Class RPCProxy

src/11/implementing_remote_procedure_call/jsonrpclient.py:3–11  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import json
2
3class RPCProxy:
4 def __init__(self, connection):
5 self._connection = connection
6 def __getattr__(self, name):
7 def do_rpc(*args, **kwargs):
8 self._connection.send(json.dumps((name, args, kwargs)))
9 result = json.loads(self._connection.recv())
10 return result
11 return do_rpc
12
13# Example use
14from multiprocessing.connection import Client

Callers 1

jsonrpclient.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected