RPC Client

RPCClient instances are high-level handlers for making remote procedure calls to servers. Other than RPCProxy objects, they are what most user applications interact with.

Clients needs to be instantiated with a protocol and a transport to function. Proxies are syntactic sugar for using clients.

class tinyrpc.client.RPCClient(protocol, transport)

Client for making RPC calls to connected servers.

Parameters:
batch_call(calls)

Experimental, use at your own peril.

call(method, args, kwargs, one_way=False)

Calls the requested method and returns the result.

If an error occured, an RPCError instance is raised.

Parameters:
  • method – Name of the method to call.
  • args – Arguments to pass to the method.
  • kwargs – Keyword arguments to pass to the method.
  • one_way – Whether or not a reply is desired.
get_proxy(prefix='', one_way=False)

Convenience method for creating a proxy.

Parameters:
Returns:

RPCProxy instance.

class tinyrpc.client.RPCProxy(client, prefix='', one_way=False)

Create a new remote proxy object.

Proxies allow calling of methods through a simpler interface. See the documentation for an example.

Parameters:
  • client – An RPCClient instance.
  • prefix – Prefix to prepend to every method name.
  • one_way – Passed to every call of call().