Getting Started with Python 3 and the Steemit API
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.
i am glad you are learning steem-python. Themarkymark was a large help to me also. I have a few things built but am new to python so its a work in progress. Ill be keeping an eye out for more. I am in discord and steemit.chat if you need help, or more likely., I need help.
very interesting topic.
are you already using the robot and how much are you earning?
I built a tool to help me with my curated roundup posts "best of steemit", it helps me read a lot faster and find the best stuff :)
ok thanks
@makerhacks what kind of bot you are about to make plz elaborate if possible I have some ideas to share but have no time to work on Python as I am not much aware of it