3 Tests you can do using steem-python api

in #programming7 years ago (edited)



Hello guys, welcome back to another useful and fun moment of programming. Sometimes back i wrote a post on how to install python 3 to your operating system. If you did not get to read the blog, then you can visit 

https://steemit.com/steemit/@samuelgichu/14528-witnesses-235725-accounts-on-steemit-great-work-steemit-community

What steem-python API does is that it enables a developer or anyone to directly interact with the steemit blockchain.


Today we shall do 3 simple tests using the steem-python API. I hope you shall find this useful


#1 LET US FIND OUT HOW MANY REGISTERED USER ACCOUNTS ARE ON STEEMIT.

run python 3 on your command prompt or terminal
write the following code

>>> from steem import Steem       # import the class Steem from steem libraries
>>> b = Steem()                   # create an instance of the class Steem
>>> b.get_account_count()         # call the method get_account_count()
253645

There are 253645 registered accounts on steemit


# 2 FIND THE STEEM DOLLAR BALANCE FOR ANY USER ON STEEMIT

>>> from steem import Steem       # import the class Steem from steem libraries

>>> b = Steem()                   # create an instance of the class Steem

>>> b. get_account('samuelgichu')['sbd_balance']

'3.875 SBD'


NOTE that 'brianadams' in this case represents the steemit username to whom i want to find the SBD balance.

# 3 FIND THE TOTAL NUMBER OF STEEM WITNESS THAT EXIST ON STEEMIT


>>> from steem import Steem       # import the class Steem from steem libraries >>> b = Steem()                   # create an instance of the class Steem

>>> b.get_witness_count()

14543

There are 14543 witnesses on steemit.

HOPE YOU LEARNED SOMETHING AND IF SO SHARE THE KNOWLEDGE WITH YOUR FRIENDS
Cheers guys!!

Sort:  

Congratulations @samuelgichu! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Coin Marketplace

STEEM 0.20
TRX 0.14
JST 0.029
BTC 67443.68
ETH 3234.73
USDT 1.00
SBD 2.65