4#How to build Steemit applications with Piston python module

in #steemit-dev7 years ago (edited)

In this post we are going to see how to get the followers for an account in steemit using python programming.

In order to build Steem apps and sites to work, we should have node to connect.
eg: one node is wss://steemd.steemit.com

For getting more information on the node, execute the below command.

$piston --node wss://steemd.steemit.com info

In order to get the followers in an account, we can use the api 'follow'. For getting installation steps for piston module read https://steemit.com/steemit/@naveendavisv/2-how-to-build-applications-for-steemit-with-python-programming

>>>from pistonapi.steemnoderpc import SteemNodeRPC
>>>ws = SteemNodeRPC("wss://steemd.steemit.com","","",apis=["follow"])
>>>fo = ws.get_followers('naveendavisv',"","blog",10,api="follow")

In order to get the following for a account.

>>>fo = ws.get_following('devisvallooran',"","blog",10,api="follow")

First we have to create an object using 'SteemNodeRPC' function in the module 'pistonapi.steemnoderpc
And when you run the get_followers method on that object , you can get the followers of the account that you have given as parameter.

Output can be viewed below:

The output is a list and we can get the values of each one using index starting from 0.

>>> fo[0]
{'follower': 'devisvallooran', 'following': 'a-2', 'what': ['blog']}
>>> fo[1]
{'follower': 'devisvallooran', 'following': 'a-3', 'what': ['blog']}





Sort:  

Great informative post! Followed and Resteemed.

Thank you. I will try to do more related posts.

Coin Marketplace

STEEM 0.28
TRX 0.12
JST 0.033
BTC 69747.29
ETH 3747.51
USDT 1.00
SBD 3.78