:mod:`vizapi.noderpc` ===================== .. py:module:: vizapi.noderpc Module Contents --------------- .. data:: log .. py:class:: NodeRPC(*args, **kwargs) Bases: :class:`grapheneapi.api.Api` .. autoapi-inheritance-diagram:: vizapi.noderpc.NodeRPC :parts: 1 :private-bases: Redefine graphene Api class. Class wraps communications with API nodes via proxying requests to lower-level :py:class:`Rpc` class and it's implementations :py:class:`Websocket` and :py:class:`Http`. To enable RPC debugging: .. code-block:: python log = logging.getLogger('vizapi') log.setLevel(logging.DEBUG) log.addHandler(logging.StreamHandler()) .. method:: post_process_exception(self, error: Exception) Process error response and raise proper exception. Called from :py:meth:`__getattr__`, which catches RPCError exception which raised by :py:meth:`Rpc.parse_response` in Rpc class. :param error: exception .. method:: updated_connection(self) .. method:: get_network(self) Cache connected network info. This avoids multiple calls of self.get_config() .. method:: _get_network(self) Identify the connected network. This call returns a dictionary with keys chain_id, core_symbol and prefix .. py:class:: Rpc(*args, **kwargs) Bases: :class:`grapheneapi.rpc.Rpc` .. autoapi-inheritance-diagram:: vizapi.noderpc.Rpc :parts: 1 :private-bases: This class is responsible for making RPC queries. Original graphene chains (like Bitshares) uses api_id in "params", while Golos and VIZ uses api name here. .. method:: __getattr__(self, name) Map all methods to RPC calls and pass through the arguments. .. py:class:: Websocket(*args, **kwargs) Bases: :class:`grapheneapi.websocket.Websocket`, :class:`vizapi.noderpc.Rpc` .. autoapi-inheritance-diagram:: vizapi.noderpc.Websocket :parts: 1 :private-bases: Interface to API node websocket endpoint. We have to override Websocket class because we need it to inherit from our own Rpc class. .. method:: __getattr__(self, name) Map all methods to RPC calls and pass through the arguments. .. py:class:: Http(*args, **kwargs) Bases: :class:`grapheneapi.http.Http`, :class:`vizapi.noderpc.Rpc` .. autoapi-inheritance-diagram:: vizapi.noderpc.Http :parts: 1 :private-bases: Interface to API node http endpoint. We have to override Websocket class because we need it to inherit from our own Rpc class. .. method:: __getattr__(self, name) Map all methods to RPC calls and pass through the arguments.