Hi steemit friends.
Very often I cannot really track the event someone upvotes a post from me. A popup comes up so fast or I cannot read it now and just click it away. So I had the idea to just write a script to list the latest upvotes on any of my posts.
I used the steem-python library. I wrote a simple python script that lists the latest upvotes and makes a .html file as a result.
The result
Hm...
Just looking at my upvotes may not be that fun. But we can easyly change the script and look for example at ;-)
It looks like everybody is right now upvoting his newest steem-secret-7-appropriate-methods-to-ask-for-votes. It's an interesting post, you should read it too.
The code
The code starts with the creation of an account object with the account name
a = Account(ACCOUNT_NAME)
Read data from the account history. Apply the filter 'vote' as we're only interested in votes.
history_events = a.get_account_history(index=-1, limit=HISTORY_LIMIT, filter_by=['vote'], raw_output=True)
Then just loop over history and write a .html file (note: i simplified the code a bit for better readability).
file = open('check_upvotes_{}_{}.html'.format(ACCOUNT_NAME, timestamp), 'w')
file.write('<HTML-CONTENT-START>')
Get the data from the data object and apply a filter for self-votes ;-)
for event in history_events:
operation = event[1]['op'][0]
name = event[1]['op'][1]['voter']
link = event[1]['op'][1]['permlink']
time = event[1]['timestamp']
if (name != ACCOUNT_NAME):
file.write('<HTML-CONTENT-ROW>')
file.write('<HTML-CONTENT-END>')
file.close()
The script is on my github account: check_upvotes_html.py
This code runs you with python3 and steem-python must be installed. The constants ACCOUNT_NAME and HISTORY_LIMIT have to be adapted before you run the script yourself
Thanks for reading my post. It was fun further experimenting with the steem-python library. If you like this post please comment or upvote.
In case you missed my other posts about steem-python:
- Check your followers with steem python
Thanks. J