My firste Steemit Bot with Python: relike someones post if they like yours

in #programming7 years ago

Introduction

In the past few days I created a Bot with the help of the Steemit Python API. This is my first bot and only for educational purposes. I wouldn't recommend running a bot like this 24/7. I hope I could help you with my post or you can tell me how to improve my code! :)

*This isn't a "copy past" script!  You need to know some basic programming knowledge to build a fully functional bot with this...

Code (Github)

Explanation:

1. Install the API itself: Just use this tutorial for windows (I tried to install it myself for like 3-4 hours but couldn't do it... this tutorial saved my evening!)

2. Import the API and exceptions for errors.

from steem import Steem
from steembase import exceptions


3 . Setup variables for the node, your account and your private keys. ( I don't know much about security... use on your own risk!)

nodes = ["https://api.steemit.com"]
 account = "wil1liam"
 keys=["private posting key", "private active key"]


4. Now the function itself. It uses your account name, keys and nodes to "log in" your account and connect to the API node.

def relike(account,keys,nodes):


5. Executing the function. It returns how many users you upvoted successfully.

print(relike(account=account,keys=keys,nodes=nodes))


Please feel free to leave some feedback :) 

(I will probably let the bot run on this post)