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 warnings and errors.
Parameters: - urls (str) – Either a single Websocket/Http URL, or a list of URLs
- user (str) – Username for Authentication
- password (str) – Password for Authentication
- num_retries (int) – Try x times to num_retries to a node on disconnect, -1 for indefinitely
- num_retries_call (int) – Repeat num_retries_call times a rpc call on node error (default is 5)
- timeout (int) – Timeout setting for https nodes (default is 60)
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_network
(props=None)¶ Identify the connected network. This call returns a dictionary with keys chain_id, core_symbol and prefix
-
get_request_id
()¶ Get request id.
-
is_appbase_ready
()¶ Check if node is appbase ready
-
next
()¶ Switches to the next node url
-
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