Skip to content

Instantly share code, notes, and snippets.

@xeroc
Created April 11, 2016 05:57
Show Gist options
  • Save xeroc/e1c52ce7754c945ca9b0e0e97512f597 to your computer and use it in GitHub Desktop.
Save xeroc/e1c52ce7754c945ca9b0e0e97512f597 to your computer and use it in GitHub Desktop.

Python Steem Libraries 0.1

Python Steem Libraries Version 1.0 released!

This library allows you to interface with the wallet and/or a steem node for polling data via RPC calls.

Download

You can download directly from github:

git clone https://github.com/xeroc/python-steem/
cd python-steem
python3 setup.py install --user

Or use pip

pip3 install steem --user

Setup

Even though you can connect to a remote full node, you can start a local node via:

cd <path-to-steem>
./programs/steemd/steemd --rpc-endpoint="127.0.0.1:8090"

Then you can connect a cli_wallet to your full node and open a new port at 8092:

./programs/cli_wallet/cli_wallet --server-rpc-endpoint=ws://localhost:8090 --rpc-http-endpoint=127.0.0.1:8092

We will use both open ports in the example.

Usage Examples

from steemapi.steemclient import SteemClient
from pprint import pprint

class Config():
    # Port and host of the RPC-HTTP-Endpoint of the wallet
    wallet_host           = "localhost"
    wallet_port           = 8092
    # Websocket URL to the full node
    witness_url           = "ws://localhost:8090"

client = SteemClient(Config)

# Calls to the Wallet

pprint(client.wallet.vote("<your-account>", "hello", "world", 100, True))

# Calls to the Node
pprint(client.node.get_trending_categories("", 20))
pprint(client.node.get_content("hello", "world"))

More examples can be found in the examples/ directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment