beemapi.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.
graphennewsrpc.
-
class
beemapi.graphenerpc.
GrapheneRPC
(urls, user=None, password=None, **kwargs)¶ Bases:
object
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)
- autoconnect (bool) – When set to false, connection is performed on the first rpc call (default is True)
- use_condenser (bool) – Use the old condenser_api rpc protocol on nodes with version 0.19.4 or higher. The settings has no effect on nodes with version of 0.19.3 or lower.
- custom_chains (dict) – custom chain which should be added to the known chains
Available APIs:
- database
- network_node
- network_broadcast
Usage:
from beemapi.graphenerpc import GrapheneRPC ws = GrapheneRPC("wss://steemd.pevo.science","","") print(ws.get_account_count()) ws = GrapheneRPC("https://api.steemit.com","","") print(ws.get_account_count())
Note
This class allows to call methods available via websocket. If you want to use the notification subsystem, please use
GrapheneWebsocket
instead.-
error_cnt
¶
-
error_cnt_call
¶
-
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.
-
get_use_appbase
()¶ Returns True if appbase ready and appbase calls are set
-
is_appbase_ready
()¶ Check if node is appbase ready
-
next
()¶ Switches to the next node url
-
num_retries
¶
-
num_retries_call
¶
-
request_send
(payload)¶
-
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
-
version_string_to_int
(network_version)¶
-
ws_send
(payload)¶
-
class
beemapi.graphenerpc.
SessionInstance
¶ Bases:
object
Singelton for the Session Instance
-
instance
= None¶
-
-
beemapi.graphenerpc.
create_ws_instance
(use_ssl=True, enable_multithread=True)¶ Get websocket instance
-
beemapi.graphenerpc.
set_session_instance
(instance)¶ Set session instance
Get session instance