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

in #programming7 years ago

Introduction

<p dir="auto">In the past few days I created a Bot with the help of the<a href="https://github.com/steemit/steem-python" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link"> 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! :) <p dir="auto">*This isn't a "copy past" script!  You need to know some basic programming knowledge to build a fully functional bot with this... <h3><a href="https://github.com/ko-redtruck/steemit-relike-bot" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Code (Github) <h3>Explanation: <p dir="auto">1. Install the API itself:<a href="https://steemd.com/@holger80/how-to-install-steem-python-for-windows" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link"> 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!) <p dir="auto">2. Import the API and exceptions for errors. <pre><code>from steem import Steem <pre><code>from steembase import exceptions <p dir="auto"><br /> <p dir="auto">3 . Setup variables for the node, your account and your private keys. ( I don't know much about security... use on your own risk!) <pre><code>nodes = ["https://api.steemit.com"] <pre><code> account = "wil1liam" <pre><code> keys=["private posting key", "private active key"] <p dir="auto"><br /> <p dir="auto">4. Now the function itself. It uses your account name, keys and nodes to "log in" your account and connect to the API node. <pre><code>def relike(account,keys,nodes): <p dir="auto"><br /> <p dir="auto">5. Executing the function. It returns how many users you upvoted successfully. <pre><code>print(relike(account=account,keys=keys,nodes=nodes)) <p dir="auto"><br /> <p dir="auto">Please feel free to leave some feedback :)  <p dir="auto">(I will probably let the bot run on this post)