Python Libraries: The Random Splash Voter

in STEMGeekslast year

Following on from the The [email protected] Pro-Active and Reactive Counter Tool, I wanted to write something a little more positive, and as I had the routines already in place, how about a Random Splash Voter?

Here I was with FOUR accounts, not working so well for me in terms of efficiency, pro-actively voting up comments knowing full well they were going to be down-voted on day 6 by a slavering @stimialiti who is still trying in vain to confuse my BOT coding.


Coming from a professional background in automation, I love the fact that we can code all this boring stuff and let computers do the menial tasks.

I was finding all of the counter-@stimialiti accounts were being underutilised and so the excess voting power needed to get working for me.

Random Splash Voter is the script I came up with from the remnants of the anti-BOT code, which takes a random account from a pre-defined list, gets the latest post that must have been created in the last 24 hours, and then grants it a 100% vote utilising the accounts from my voters' list.

Yes, that’s quite a mouthful and over-worded I know, so let me break it down.

The accounts, @wanker, @bingbabe, @dismayedworld have all had some HP delegated to them, and it needs using up on the right kinds of content.


The script is kicked off manually, gets a random account using this quite simple line, and then checks all FOUR accounts for their voting power levels.

The random account’s posts are obtained that are pending rewards and all are discarded except for the latest one. If that is older than 24 hours then that is also ignored.

…'well... I want full curation for my votes, you can't blame me!'…

If a suitable post is found then each account will bestow a 100% vote if its voting power is above 75%.


Some HIVE users may have already noticed these votes randomly splashing on their content, and if so you are already part of the voting list.

One problem I did encounter was duplicate voting. For example, if a post has a vote of 50% from an account and then the same weight is attempted again, Python will throw an exception.

I was using a Try: statement to begin to get around this but issues were creeping in if the post was voted twice at different weights.

In this case, the second vote overwrites the first one, nullifying it and denying the voter of curation rewards on the second vote.


...'HasAuthorVoted returns a Boolean True or False, and takes the parameters of the voter and post data'...

I had to find a more elegant solution than using Try: as it's lazy arse coding and came up with a function that checks the post, enumerates the voters, and returns a Boolean value to the function call.

What I noticed while doing this was when I ran the code, ‘voterlist’ returns a list but it’s really a dictionary.

Enumerating it using dictionary parsing methods such as .keys and .values were all failing so I had to use list commands.



I still don’t understand why the (type(voterlist)) command returns a list, so please feel free to educate me.

I have added this routine (above) which can be slotted into anyone’s code.

Lastly, the whole main section is ran by a loop which keeps going until all the accounts are below 75% VP. So I can kick it off, go and have a shower and it's all done when I get out.


For Python veterans, I suppose all this is quite noddy stuff but I am finding it interesting and have that drive to learn more.

If you have read this far and am not a programmer then your eyes are probably glazed over and you need more coffee, so let’s get to the more interesting part.


After raiding @steevc's @tenkminnows voting list I now have quite an extensive list of HIVE accounts in my ‘votees’ list but would like some more.

Adding your account to the list gives no guarantee of votes as by design this is a random voter but I can tell you that when I run this script, it passes by many posts as they don't make the criteria.

They are too old, they have already been voted or the VP of the voting accounts is too low. It does skip a lot of content!


...'sorry, I will get you next time when the VP level's have gone up some'...

If you want some free votes, are not a spammer, can generate something that people want to read, don't cash out all your rewards, am not already being followed by ME, respond to comments, are not an arsehole, and are generally ignored then feel free to drop me a comment.

I will look over your blog and add you to the list if all the criteria above is met (especially the second to the last one).

Don’t expect massive votes, as these accounts are not large ones, but they will help.


  • Earn currency while you play brewing virtual beer with CryptoBrewMaster
  • Earn currency while you play and become a global Rock Star with Rising Star



Drooling Maniac.JPG

If you found this article so invigorating that you are now a positively googly-eyed, drooling lunatic with dripping saliva or even if you liked it just a bit, then please upvote, comment, rehive, engage me or all of these things.


All fun stuff. I expect some of the code could be made more 'Pythonic'. There are ways to process lists and dictionaries without resorting to a loop, but if it ain't broke...

We can do so much with the beem library. I am looking into other possibilities. I would like to get it running on a Raspberry Pi. I installed it, but got an error as soon as I imported it into a script. I need to look into that some more.

I tried many ways to search the list (that looks like a dictionary). The 'in' command is the easiest and works, but does not find the value. It was a case of what does work in the end. I'm a VB coder, so expect my style to be of that vein.

The Pi does seem a good option to run a script on 24 hours.

I still don’t understand why the (type(voterlist)) command returns a list

I guess it is "active_votes": ["trayciyork","slobberchops","steevc"], hence voterlist=["trayciyork","slobberchops","steevc"], which naturally returns a list as a type

Had to edit the comment to add a suggestion to deal with duplicate votes - to keep a list of items voted on. So if true, vote, add to the list, check if on the list if not, check if true, vote, add to the list...
Just an idea

If you print what (voterlist) returns.. this is what it looks like:


Those pairings are the hallmarks of a dictionary variable, and yet it insists it's a list.

Since it's [], it's a list.

From what I can see, [] is a list, and {} is a dictionary, so [{}], .. is as @rimicane says, a list of dictionaries.



It seems there is a such a thing, which I wasn't aware of. The regular 'in' operator as a search does not work on this type so I just messed around with it until I found something that did!

It's a list of JSONs, actually.

for thing in list:
    if thing['voter'] == 'thingey':
        do stuff

Something like this should work.

Yes, that's exactly what I used.

 for item in voterlist:
     if item['voter'] == strvoter:

ok, still a list type ( or better say a list of dictionaries):

[ { }, { }, { } ... { } ]

Now to be honest I have no idea about what you written here, but I manfully tried to make sense of it.
At the end I realized that even if I read this a hundred times, I would still not have an idea.
So to be fair my way of life includes the saying, to each his own, and I rather leave this kinda stuff to professionals like you.

LOL, I wouldn't expect everyone to understand this (other than free votes). I wish I could call myself a Python Pro, companies are paying big money for services, I have looked.

Well you are not too old to do a python course and a bonus is that you already are familiar with some of it.
Papillon has started a coding course for poor school children, but as I know nothing about it, we partnered with another Non Profit and they have professional tutors that are teaching the kids.

So you still have to manually start it each day? That seems very tedious :) Just kidding. Nice job. I will have to think of something I want to do sometime and try to write my own code. Just don't get mad if I bug you in Discord every five minutes.

I was tempted to ask about everything when I started. It's better if you can figure it out yourself, the self-satisfaction is quite intense. There are times when a second pair of eyes should be used.

The VP levels of these accounts may now be over 75%, so after running '' I will be able to run it again in a few hours. It's designed to use only the excess VP, after that other script.

I am not a programmer, but I do like post and information that shows some of the work flow of python. Some of it is actually beginning to sink in a little bit. Yes it does make the eyes wobbly and gives a sudden desire for coffee, but I did manage to read it all.

Countering adverse actions seems to be a pretty hard thing to do.

With the function call, I included the call to it as well as the function itself. There have been so many times where I wanted to see the call and how it works.. and it's omitted. It's essential for me to see good examples.

Woah... you are not just a vampire hunter/ ruined building spelunker, but also kick-ass coder? Sweet!

I do this stuff professionally, but not all of my ilk can code. It gives me the edge when trying to get gigs over the rest. I am a hack and slash coder but can get things to work.

I am just good at copy/paste and then change the variable names. lol

You will soon be a full time python'r!! Good work on the splashing!

It has crossed my mind to look for Python gigs. Can you imagine the interview?

...'I wrote a script to counter votes from some extremist bloke who has it in for me'...

They would not have a clue what I was talking about and may be marched out of the building. We live in a different universe.

That would be funny. When you put it like that it puts into context how nuts and removed from normal everyday life for folk blockchain antics can be!

you have come along way since your humble stock lad image.

Dire knew I was an early adaptor computer freak even then but never asked me a thing. I won't elaborate as it's part of another 'Horrors' chapter. IT has done me well over the years, I was never destined to stack shelves forever.

I don't think when you reach a certain age you would be able to lift those boxes of chum and whiskas onto the "top shelf". Fucking hell they were heavy

Youre on another level, im over here slanging manual upvotes like a caveman

I'm right in the mood now for doing some more, need another project!

If my coding skills only went beyond basic arduino :(
But I'd be happy to be on your list; even though I am not that active those days, maybe I'll be lucky.

Posted via

Consider yourself added, I have known you long enough.

If you got any questions about been or Python, I am somewhat advanced...

Thanks, this little project is now complete so I will need to think of another... something that is useful. I can't code unless I have my sights on some kind of goal.

I wish my brain worked this way. I can get it to an extent, but I am more of a puzzle solver, artistic brain type. I have a hard time with musical instruments too.. If I had the free time, this looks like it would be fun to play with and try to learn. Not for a living but for the fun of it! The excitement of making something work for the hell of it.

Hope you get it all figured out and I will be looking forward to maybe catching a "Random" vote. hehehe. Enjoy!!!

The excitement of making something work for the hell of it.

You do get an enormous sense of gratification when producing something unique, as that's what it is. Your code is your own, and there's none other like it.

Hope you get it all figured out and I will be looking forward to maybe catching a "Random" vote.

I am sure some have already gone your way. You were one of the first to be added.

I am sure it has.. But many others need them more than I. Either way I am always grateful. 😁

Can't wait for your next Urban Explorer post.. You have to be running out of abandoned buildings soon! lol

You have to be running out of abandoned buildings soon!

There are many left but I find I have to travel further now. I am still on last July's content yet so have plenty left in the bag. I am going to Liverpool this weekend (weather pending) and have some new ones lined up. You never know what's going to happen, talk about unpredictable!

I can only imagine what one may unexpectedly find on such an adventure.. Hopefully no skeletons. Yikes. You usually find some cool stuff though.


 last year 

Oh look! We vote some of the same people.

I don't know half of those in that list, only that they are not spammers/con-atists/abusers... I hope.

 last year 

We just hit them very hard if they are bad.


Your content has been voted as a part of Encouragement program. Keep up the good work!

Use Ecency daily to boost your growth on platform!

Support Ecency
Vote for new Proposal
Delegate HP and earn more

I was in until you said I couldn't be an arsehole. This is the internet, man! Who wants to be civil? Where's the fun in that?

I have passion for programming.I hope I learn it somedays

 last year Reveal Comment

It all looks alright to me, I see you like your Guinness. Being from Ireland, it couldn't be anything else! You are added.

 last year Reveal Comment