INNER CODE UNIT · Python

RpcCaller

permitio/fastapi_websocket_rpc · fastapi_websocket_rpc/rpc_channel.py:89

class RpcCaller:
    """
    Helper class provide an object (aka other) with callable methods for each remote method on the otherside
    """

    def __init__(self, channel, methods=None) -> None:
        self._channel = channel
        self._method_names = (
            [method[0] for method in getmembers(methods, lambda i: ismethod(i))]
            if methods is not None
            else None
        )

    def __getattribute__(self, name: str):
        if (not name.startswith("_") or name in EXPOSED_BUILT_IN_METHODS) and (
            self._method_names is None or name in self._method_names
        ):
            return RpcProxy(self._channel, name)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…