As mentioned elsewhere, I dipped my toes into the Steemit API using Python and an off the shelf virtual server. Several people were interested and wanted to create their own Steem bots, so for those who wanted to do the same, here is what I did.
Installation
First, as the above image shows, I bought a virtual server especially for this. That sounds expensive or maybe even wasteful, but you can get a pretty beefy machine for just $5/mo, and you will more than make that back.
(I just resized mine for free - noice)
You will also need Python 3 and various libraries. @themarkymark helped me with this because somehow I kept borking it.
Here is the ingredients list:
- Grab Miniconda3
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
- Install LibSSL
sudo apt-get install libssl-dev
- Steem
python3 -m pip install steem
- and optionally, bpython
python3 -m pip install bpython
(this enables a rich Python interface with syntax highlighting etc)
Hello World
To test everything is working, let's create a simple script that uses the Steem class.
The code below will print the current SBD balance of my account :)
# first, we initialize Steem class
from steem import Steem
s = Steem()
# now we can call the API to check the SBD
# and output to the console
print( s.get_account('makerhacks')['sbd_balance'] )
Easy!
The API can do lots of cool stuff, we will dig in over future tutorials.