from uwsgiconf.runtime.rpc import register_rpc, make_rpc_call, get_rpc_list

def expose_me(arg1, arg2=15):
    print('RPC called %s' % arg1)

make_rpc_call('expose_me', ['value1'])

all_rpc = get_rpc_list()  # Registered RPC items list.
uwsgiconf.runtime.rpc.register_rpc(name: str = None) → Callable

Decorator. Allows registering a function for RPC.

def expose_me(arg1, arg2=15):
    print(f'RPC called {arg1}')
    return b'some'

make_rpc_call('expose_me', ['value1'])


Function expected to accept bytes args. Also expected to return bytes or None.

Parameters:name – RPC function name to associate with decorated function.
uwsgiconf.runtime.rpc.make_rpc_call(func_name: str, *, args: Sequence[str] = None, remote: str = None) → Optional[str]

Performs an RPC function call (local or remote) with the given arguments.

  • func_name – RPC function name to call.
  • args (Iterable) –

    Function arguments.


    Strings are expected.

  • remote

ValueError – If unable to call RPC function.

uwsgiconf.runtime.rpc.get_rpc_list() → List[str]

Returns registered RPC functions names.