Asynchronous Steem Client

Configuration

class steemapi.steemasyncclient.Config(**kwargs)

The Config class is used to contain all the parameters needed by SteemAsyncClient in a neat and simple object. The main parameters needed are the witness connection parameters and the mapping of aliases used in code to Steem APIs that are requested to be initialized by SteemAsyncClient on behalf of the code.

The simplest way to create a valid Config object is to pass the keyword arguments to the constructor to initialize the relevant parameters, as the following example demonstrates:

config = Config(witness_url      = "ws://localhost:8090/",
                witness_user     = "",
                witness_password = "",
                witness_apis     = {"db": "database",
                                    "broadcast": "network_broadcast"},
                wallet_url       = "ws://localhost:8091/",
                wallet_user      = "",
                wallet_password  = "")

But the better way to create the Config object is to put the parameters in YAML configuration file and load it as in the following example:

config = Config(config_file = "/path/to/config.yml")

Note that you can combine both methods by specifying a config_file but then selectively overriding any of the paramaters from the configuration file by specifying them directly as keyword arguments to the Config constructor.

SteemAsyncClient

class steemapi.steemasyncclient.SteemAsyncClient(config)

Steem Asynchronous Client

The SteemAsyncClient class is an abstraction layer that makes asynchronous use of the RPC API of either steemd (witness) or cli_wallet (wallet) easy to use.

Parameters:config (class) – the configuration class

Example usage of this class:

from steemasyncclient import SteemAsyncClient, Config

@asyncio.coroutine
def print_block_number(steem):
   res = yield from steem.database.get_dynamic_global_properties()
   print(res["head_block_number"])

steem = SteemAsyncClient(Config(witness_url="ws://localhost:8090",
                                witness_apis=["database"]))
steem.run([print_block_number])

See more examples of how to use this class in the examples folder.