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!!