create account

Getting Started with Python 3 and the Steemit API by makerhacks

View this thread on: hive.blogpeakd.comecency.com
· @makerhacks ·
$7.92
Getting Started with Python 3 and the Steemit API
![DigitalOcean - Droplets.png](https://steemitimages.com/DQmVDSz9fe1rCDZPwTDaTaE9Z4JcGakFoqpXoLe5SQetVTH/DigitalOcean%20-%20Droplets.png)

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.

![Kicking Off the New Year with New Droplet Plans.png](https://steemitimages.com/DQmf81AuBxxcyYy1TT7hjS6Xg5t32AfDr9JRXzTsHjppepE/Kicking%20Off%20the%20New%20Year%20with%20New%20Droplet%20Plans.png)

(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](https://conda.io/miniconda.html ) ```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.

## Make sure you follow me so you don't miss any posts. If you liked this, please upvote :)
👍  , , , , , , , , ,
properties (23)
authormakerhacks
permlinkgetting-started-with-python-3-and-the-steemit-api
categorypython
json_metadata{"tags":["python","coding","programming","technology","steemit"],"users":["themarkymark"],"image":["https://steemitimages.com/DQmVDSz9fe1rCDZPwTDaTaE9Z4JcGakFoqpXoLe5SQetVTH/DigitalOcean%20-%20Droplets.png","https://steemitimages.com/DQmf81AuBxxcyYy1TT7hjS6Xg5t32AfDr9JRXzTsHjppepE/Kicking%20Off%20the%20New%20Year%20with%20New%20Droplet%20Plans.png"],"links":["https://conda.io/miniconda.html"],"app":"steemit/0.1","format":"markdown"}
created2018-01-18 19:50:33
last_update2018-01-18 19:50:33
depth0
children11
last_payout2018-01-25 19:50:33
cashout_time1969-12-31 23:59:59
total_payout_value6.508 HBD
curator_payout_value1.407 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,930
author_reputation156,478,962,956,499
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,467,343
net_rshares959,198,463,973
author_curate_reward""
vote details (10)
@ardox ·
very interesting topic.
are you already using the robot and how much are you earning?
properties (22)
authorardox
permlinkre-makerhacks-getting-started-with-python-3-and-the-steemit-api-20180118t195417164z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-01-18 19:54:15
last_update2018-01-18 19:54:15
depth1
children2
last_payout2018-01-25 19:54:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length85
author_reputation23,087,375,172
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,467,992
net_rshares0
@makerhacks ·
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 :)
👍  
properties (23)
authormakerhacks
permlinkre-ardox-re-makerhacks-getting-started-with-python-3-and-the-steemit-api-20180118t195736352z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-01-18 19:57:36
last_update2018-01-18 19:57:36
depth2
children1
last_payout2018-01-25 19:57:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length131
author_reputation156,478,962,956,499
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,468,571
net_rshares506,469,190
author_curate_reward""
vote details (1)
@ardox ·
ok thanks
properties (22)
authorardox
permlinkre-makerhacks-re-ardox-re-makerhacks-getting-started-with-python-3-and-the-steemit-api-20180118t204305557z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-01-18 20:43:03
last_update2018-01-18 20:43:03
depth3
children0
last_payout2018-01-25 20:43:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length9
author_reputation23,087,375,172
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,475,904
net_rshares0
@nicnas · (edited)
$0.09
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.
👍  
properties (23)
authornicnas
permlinkre-makerhacks-getting-started-with-python-3-and-the-steemit-api-20180119t022022906z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-01-19 02:20:27
last_update2018-01-19 02:22:06
depth1
children0
last_payout2018-01-26 02:20:27
cashout_time1969-12-31 23:59:59
total_payout_value0.064 HBD
curator_payout_value0.021 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length273
author_reputation38,554,121,369,241
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,524,419
net_rshares10,845,885,647
author_curate_reward""
vote details (1)
@themarkymark ·
$0.34
If you use the official steem-python you need to edit the metadata file to change the `toml` package requirement to use 0.9.3 instead of 0.9.3.1 that was removed by the third party dev.

I have switched my servers to use @furion's version of steem-python which is updated more frequently and doesn't have this problem.

`python3 -m pip install -U git+git://github.com/Netherdrake/steem-python`

I would make sure you remove the other version before installing this one.

It fixes a few issues I've been having outside of just the installation issue.
👍  , ,
properties (23)
authorthemarkymark
permlinkre-makerhacks-getting-started-with-python-3-and-the-steemit-api-20180118t195525860z
categorypython
json_metadata{"tags":["python"],"users":["furion"],"app":"steemit/0.1"}
created2018-01-18 19:55:21
last_update2018-01-18 19:55:21
depth1
children5
last_payout2018-01-25 19:55:21
cashout_time1969-12-31 23:59:59
total_payout_value0.304 HBD
curator_payout_value0.034 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length549
author_reputation1,774,088,461,856,117
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,468,168
net_rshares41,361,204,762
author_curate_reward""
vote details (3)
@makerhacks ·
Thank you! Will do that asap :)
properties (22)
authormakerhacks
permlinkre-themarkymark-re-makerhacks-getting-started-with-python-3-and-the-steemit-api-20180118t195826914z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-01-18 19:58:27
last_update2018-01-18 19:58:27
depth2
children3
last_payout2018-01-25 19:58:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length31
author_reputation156,478,962,956,499
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,468,705
net_rshares0
@makerhacks ·
python3 -m pip uninstall steem
python3 -m pip install -U git+git://github.com/Netherdrake/steem-python
properties (22)
authormakerhacks
permlinkre-makerhacks-re-themarkymark-re-makerhacks-getting-started-with-python-3-and-the-steemit-api-20180118t200409661z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-01-18 20:04:09
last_update2018-01-18 20:04:09
depth3
children2
last_payout2018-01-25 20:04:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length102
author_reputation156,478,962,956,499
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,469,688
net_rshares0
@veleje ·
$0.08
Thank you, removing steem and replacing it with furion's version of steem-python helped me also, I was pulling my hair out for last few days.
👍  
properties (23)
authorveleje
permlinkre-themarkymark-re-makerhacks-getting-started-with-python-3-and-the-steemit-api-20180118t210209357z
categorypython
json_metadata{"tags":["python"],"app":"steemit/0.1"}
created2018-01-18 21:02:09
last_update2018-01-18 21:02:09
depth2
children0
last_payout2018-01-25 21:02:09
cashout_time1969-12-31 23:59:59
total_payout_value0.064 HBD
curator_payout_value0.017 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length141
author_reputation490,220,361,761
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,479,056
net_rshares10,380,111,417
author_curate_reward""
vote details (1)
@vishalhkothari ·
@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
properties (22)
authorvishalhkothari
permlinkre-makerhacks-getting-started-with-python-3-and-the-steemit-api-20180119t082654808z
categorypython
json_metadata{"tags":["python"],"users":["makerhacks"],"app":"steemit/0.1"}
created2018-01-19 08:26:57
last_update2018-01-19 08:26:57
depth1
children0
last_payout2018-01-26 08:26:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length167
author_reputation3,418,555,827,595
root_title"Getting Started with Python 3 and the Steemit API"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,576,466
net_rshares0