steem-python: check your account upvotes

in #python7 years ago (edited)

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 @jerrybanfield ;-)
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

Sort:  

This post has received a 0.63 % upvote from @drotto thanks to: @banjo.

This post has received a 13.60 % upvote from @buildawhale thanks to: @jjb777. Send 0.100 or more SBD to @buildawhale with a post link in the memo field to bid on the next vote.

To support our curation initiative, please vote on my owner, @themarkymark, as a Steem Witness

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by jjb777 from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

Holy smokes this is so much value my friend :)

Keep doing great things, thanks for sharing this for us Steemians to use.

-Paul

Wow...python can really do this.
Thanks man

It can do lots more. Stay tuned for my next scripts. J

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.029
BTC 57809.89
ETH 3118.43
USDT 1.00
SBD 2.37