GrapheneRPC¶
Note
This is a low level class that can be used in combination with GrapheneClient
This class allows to call API methods exposed by the witness node via websockets. It does not support notifications and is not run asynchronously.
-
class
beemgrapheneapi.graphenerpc.
GrapheneRPC
(urls, user=None, password=None, **kwargs)¶ This class allows to call API methods synchronously, without callbacks.
It logs in and registers to the APIs:
- database
- history
Parameters: - urls (str) – Either a single Websocket/Http URL, or a list of URLs
- user (str) – Username for Authentication
- password (str) – Password for Authentication
- apis (Array) – List of APIs to register to (default: [“database”, “network_broadcast”])
- num_retries (int) – Try x times to num_retries to a node on disconnect, -1 for indefinitely
Available APIs
- database
- network_node
- network_broadcast
Usage:
Note
This class allows to call methods available via websocket. If you want to use the notification subsystem, please use
GrapheneWebsocket
instead.-
get_request_id
()¶ Get request id.
-
is_appbase_ready
()¶ Check if node is appbase ready
-
register_apis
()¶ Register apis.
-
rpcclose
()¶ Close Websocket
-
rpcconnect
(next_url=True)¶ Connect to next url in a loop.
-
rpcexec
(payload)¶ Execute a call by sending the payload.
Parameters: payload (json) – Payload data
Raises: - ValueError – if the server does not respond in proper JSON format
- RPCError – if the server returns an error
-
rpclogin
(user, password)¶ Login into Websocket