Steem Client

Warning

This class is going to be deprecated soon!

Configuration

class pistonapi.steemclient.ExampleConfig

The behavior of your program (e.g. reactions on messages) can be defined in a separated class (here called Config(). It contains the wallet and witness connection parameters:

The config class is used to define several attributes and methods that will be used during API communication. This is particularily useful when dealing with event-driven websocket notifications.

RPC-Only Connections:

The simples setup for this class is a simply RPC:

class Config():
    wallet_host           = "localhost"
    wallet_port           = 8092
    wallet_user           = ""
    wallet_password       = ""

and allows the use of rpc commands similar to the SteemWalletRPC class:

steem = SteemClient(Config)
print(steem.rpc.info())
print(steem.rpc.get_account("init0"))
print(steem.rpc.get_asset("USD"))

All methods within steem.rpc are mapped to the corresponding RPC call of the wallet and the parameters are handed over directly.

Additional Websocket Connections:

class Config():  ## Note the dependency
    wallet_host           = "localhost"
    wallet_port           = 8092
    wallet_user           = ""
    wallet_password       = ""
    witness_url           = "ws://localhost:8090/"
    witness_user          = ""
    witness_password      = ""

All methods within steem.ws are mapped to the corresponding RPC call of the full/witness node and the parameters are handed over directly.

wallet_host = 'localhost'

Wallet connection parameters

witness_url = 'ws://localhost:8090/'

Witness connection parameter

SteemClient

class pistonapi.steemclient.SteemClient(config, **kwargs)

The SteemClient class is an abstraction layer that makes the use of the RPC and the websocket interface easier to use. A part of this abstraction layer is to simplyfy the usage of objects and have an internal objects map updated to reduce unecessary queries (for enabled websocket connections). Advanced developers are of course free to use the underlying API classes instead as well.

Parameters:config (class) – the configuration class

If a websocket connection is configured, the websocket subsystem can be run by:

steem = SteemClient(config)
steem.run()
rpc = None

RPC connection to the cli-wallet

ws = None

Websocket connection to the witness/full node