SHARE YOUR CODE: Using SteemTools to get accounts info

in #steemtools8 years ago (edited)

I came across @furion's post today and I immediately started trying to build stuff with it. I am a python noob and I enjoy creating short scripts that make your life simple.

Here is a program that allows you to search any account and get their basic info:

  • Steem Power
  • Account's Reputation
  • Voting Power
  • Average Payout per post

Any programmer can build such a script just by taking a quick glance at @furion's post, but here is the step by step guide for hobbyists like me:

1.- Open the Terminal in linux, if you don´t have linux you can get a cheap vps with Ubuntu on Vultr (that is my ref link, you can get $20 bonus with it).

2.- Install python3 and its dependencies:

sudo apt-get install python3-setuptools
sudo easy_install3 pip

3.- Install SteemTools:

pip install steemtools

4.- I recommend you build a folder for all your future steemtools scripts:

mkdir steemtools

5.- Go to the folder you just created:

cd steemtools

6.- Create the file for the script, you can name it whatever you want as long as it has .py at the end:

sudo nano overview.py

7.- paste this code inside the program:


from steemtools.base import Account

account = Account(input("enter account: "))

sp = account.get_sp()
print ("Steem Power ", sp)

rep = account.reputation()
print ("reputation ", rep)

voting = account.voting_power()
print ("voting power", voting, "%")

payout = account.avg_payout_per_post()
print ("average payout per post", payout)

8.- Press CTRL + X to quit the editor and Y to save it.

9.- Run the program:

python3 overview.py

python_script

And there you have it, you can repeat step 9 with as many accounts as you want and check their stats.

if you want to know your stats but don't want to install the script just drop a comment below and I can give you the info on your account


NOTE: If you don´t run your own node, please follow the @furion ´s instructions on his post´s comment: https://steemit.com/steemtools/@furion/ann-steemtools-a-high-level-python-library-for-steem

Sort:  

Very cool. Thanks for sharing:)

Cool!!!! Thanks for sharing the info. Appreciate it @chitty

I recommend using python console for experiments. This is much faster than writing the full script. Just enter python + enter and then for example:

(pysteem) 09:27:29 /sandbox$ python
Python 3.4.3 (default, Oct 14 2015, 20:28:29) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from steemtools.base import Account
Lost connection to node during wsconnect(): ws://127.0.0.1:8090 (1/-1) Retrying in 0 seconds
Lost connection to node during wsconnect(): ws://127.0.0.1:8090 (1/-1) Retrying in 0 seconds
Lost connection to node during wsconnect(): ws://127.0.0.1:8090 (1/-1) Retrying in 0 seconds
>>> a = Account("cryptomental")
>>> a.get_sp()
227.67634972037933
>>> 
>>> 
>>> a.voting_power()
99.27
>>> quit()
(pysteem) 09:28:49 /sandbox$ 

The warnings that you see in the beginning are 'normal' when you are not using a local node but steem.ws node.

Coin Marketplace

STEEM 0.16
TRX 0.15
JST 0.028
BTC 55885.64
ETH 2358.26
USDT 1.00
SBD 2.31