/
productivesteemians.py
50 lines (35 loc) · 1.39 KB
/
productivesteemians.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# thanks @furion for the tip
from steemapi.steemnoderpc import SteemNodeRPC
rpc = SteemNodeRPC('ws://node.steem.ws')
import csv
allauthors = rpc.lookup_accounts('', 1000000)
postdict = dict()
repdict = dict()
rewdict = dict()
# counting author posts and adding them to the postdict dictionary
# retrieving authors with more than 700 posts (blogposts and comments)
for author in allauthors:
postcount = rpc.get_account(author)['post_count']
if postcount > 700:
postdict[author] = postcount
# retrieving reputation and post rewards for the authors in postdict
for author2 in postdict.keys():
repcount = rpc.get_account(author2)['reputation']
rewcount = rpc.get_account(author2)['posting_rewards']
repdict[author2] = repcount
rewdict[author2] = rewcount
# indexing results for posts
writefile1 = open('productivesteemians-posts.csv', 'w', newline='')
writer1 = csv.writer(writefile1)
for pauth, pcount in postdict.items():
writer1.writerow([pauth, pcount])
# indexing results for reputation
writefile2 = open('productivesteemians-rep.csv', 'w', newline='')
writer2 = csv.writer(writefile2)
for rpauth, rpcount in repdict.items():
writer2.writerow([rpauth, rpcount])
# indexing results for rewards
writefile3 = open('productivesteemians-rew.csv', 'w', newline='')
writer3 = csv.writer(writefile3)
for rwauth, rwcount in rewdict.items():
writer3.writerow([rwauth, rwcount])