Python for STEEM: How to beem by felixxx

View this thread on steempeak.com
· @felixxx · (edited)
$22.24
Python for STEEM: How to beem
>This is meant as the first part to a series of tutorials.
The goal is to produce a hands-on guide for people who want to jump straight into developing tools for STEEM.

###
In  this part, I will try to guide you through the process of installing beem.
[beem](https://github.com/holgern/beem) is a Python library for STEEM and is based on [steem-python](https://github.com/steemit/steem-python), which is based on [piston-lib](https://github.com/xeroc/piston-lib).
While steem-python is the official lib, I chose beem, because it is updated more frequently. ( At this time, the last update to steem-python is 9 months old)

While it is possible to install Python and beem on Windows, I will start by setting up a virtual machine, which I will install Linux on.
In my opinion, this has multiple benefits, the main one being that it will encapsulate your development environment; Whatever abomination you code up, it will not be able to wreck your main operating system - In the worst case, you can stop the virtual machine and start it again.

I believe this method to be the easiest for most people.
If you want to install beem on a different system, this is not the right guide for you. If you can figure it out on your own, you can jump a chapter ahead.

## VMware 
####
There is a free version of VMware, which is ideal for our purposes:
https://www.vmware.com/products/workstation-player.html
Make sure to download the Workstation **Player**, as only that is free to use.

Install this, make sure to uncheck the regular updates nonsense.

## Ubuntu
####
I will go with Ubuntu 18.04.3 LTS, as that seems to be the most popular choice at the moment.
https://ubuntu.com/download/desktop

Open VMware, create a new virtual machine using a Ubuntu 18.04.3 LTS image.
- 10 GB HDD, 2 GB RAM is enough, perhaps less
- You do not need VMware tools
- Set a password. I bricked my first Linux ever, by trying to set it up with a blank password.
It does not have to be especially secure.

## beem
####
If you are new to Linux - don't panic ! I don't get it either.
Before doing anything, remove Amazon from you 'Favourites' menu.
If your keyboard layout is not English, you need to go to 'Region and Languages' and **add a new** keyboard layout, which makes no sense, and is very confusing.
- ``ctrl``+``alt``+``t `` opens a new terminal.
- ``sudo apt-get update``
Apparently, this will update your system.
It is always recommended. Once you have a running bot for STEEM, this might completely ruin your day, though.
___
_**Note**: 
``ctrl+c``, ``ctrl+v`` do not work like they do in Windows. 
This is just to confuse everybody._
___
- ``sudo apt-get install build-essential libssl-dev python-dev``
- yes
- ``sudo apt install python3-pip``
- yes
- ``sudo pip3 install beem``
- yes

## Test
####
The easiest way to test, if it went right, is to:
``beempy --help``
beempy is a wallet that is built on beem.
If you see a list of help topics, you have successfully set up beem.

To test your first own script, create a new file:
``gedit beemtest.py``
This will open a text editor.
```
from beem.blockchain import Blockchain
blockchain = Blockchain()
print(blockchain.get_current_block_num())
```
paste the above 3 lines of code and save the file.
```python3 beemtest.py```
This will execute your script and should print the current head-block number on your screen.

## Congratulations
####
If it did not work as intended, comment below.

I hope @flipstar gets to test this.
Also mentioning @revisesociology for good measure.

## [-> Part 2](https://steemit.com/busy/@felixxx/pyhton-for-steem-2-json)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 124 others
properties (23)
post_id81,186,959
authorfelixxx
permlinkpython-for-steem-how-to-beem
categorybusy
json_metadata{"community":"busy","app":"steemit\/0.1","format":"markdown","tags":["steem","beem","python","tutorial"],"users":["flipstar","revisesociology"],"links":["https:\/\/github.com\/holgern\/beem","https:\/\/github.com\/steemit\/steem-python","https:\/\/github.com\/xeroc\/piston-lib","https:\/\/www.vmware.com\/products\/workstation-player.html","https:\/\/ubuntu.com\/download\/desktop","https:\/\/steemit.com\/busy\/@felixxx\/pyhton-for-steem-2-json"]}
created2019-10-25 13:09:57
last_update2019-10-30 15:33:18
depth0
children24
net_rshares74,329,119,087,262
last_payout2019-11-01 13:09:57
cashout_time1969-12-31 23:59:59
total_payout_value10.758 SBD
curator_payout_value11.485 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length3,587
author_reputation66,238,594,869,311
root_title"Python for STEEM: How to beem"
beneficiaries
0.
accountbusy.org
weight1,000
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (188)
@cardboard ·
@tipu curate ;)
properties (22)
post_id81,187,158
authorcardboard
permlinkpzxma2
categorybusy
json_metadata{"users":["tipu"],"app":"steemit\/0.1"}
created2019-10-25 13:18:06
last_update2019-10-25 13:18:06
depth1
children3
net_rshares0
last_payout2019-11-01 13:18:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length15
author_reputation11,779,072,940,600
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@luegenbaron ·
dammit
properties (22)
post_id81,187,245
authorluegenbaron
permlinkre-cardboard-pzxmea
categorybusy
json_metadata{"tags":["busy"],"app":"steempeak\/1.18.5"}
created2019-10-25 13:20:33
last_update2019-10-25 13:20:33
depth2
children2
net_rshares0
last_payout2019-11-01 13:20:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length6
author_reputation23,622,906,626,344
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@cardboard ·
Out of mana! Your turn;)
properties (22)
post_id81,187,294
authorcardboard
permlinkpzxmgm
categorybusy
json_metadata{"app":"steemit\/0.1"}
created2019-10-25 13:22:03
last_update2019-10-25 13:22:03
depth3
children1
net_rshares0
last_payout2019-11-01 13:22:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length24
author_reputation11,779,072,940,600
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@luegenbaron ·
__Nice!__
*Now you only need to learn python!*
@tipu curate ;)
properties (22)
post_id81,187,235
authorluegenbaron
permlinkre-felixxx-pzxmdt
categorybusy
json_metadata{"tags":["busy"],"app":"steempeak\/1.18.5"}
created2019-10-25 13:20:18
last_update2019-10-25 13:20:18
depth1
children3
net_rshares0
last_payout2019-11-01 13:20:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length62
author_reputation23,622,906,626,344
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@tipu ·
<a href="https://tipu.online/curator?luegenbaron" target="_blank">Upvoted &#128076;</a> (Mana: 5/20)
properties (22)
post_id81,187,250
authortipu
permlinkre-re-felixxx-pzxmdt-20191025t132037
categorybusy
json_metadata{}
created2019-10-25 13:20:39
last_update2019-10-25 13:20:39
depth2
children0
net_rshares0
last_payout2019-11-01 13:20:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length100
author_reputation55,804,171,747,699
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@felixxx ·
While in many ways I am still a beginner, I can work with it alright :(
properties (22)
post_id81,187,340
authorfelixxx
permlinkpzxmip
categorybusy
json_metadata{"app":"steemit\/0.1"}
created2019-10-25 13:23:12
last_update2019-10-25 13:23:12
depth2
children1
net_rshares0
last_payout2019-11-01 13:23:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length71
author_reputation66,238,594,869,311
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@luegenbaron ·
Feel you, my skills are definetely worse ^^
properties (22)
post_id81,190,846
authorluegenbaron
permlinkre-felixxx-pzxsg5
categorybusy
json_metadata{"tags":["busy"],"app":"steempeak\/1.19.0"}
created2019-10-25 15:31:18
last_update2019-10-25 15:31:18
depth3
children0
net_rshares0
last_payout2019-11-01 15:31:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length43
author_reputation23,622,906,626,344
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@isnochys ·
How to !BEER !
:)
properties (22)
post_id81,187,897
authorisnochys
permlinkpzxngg
categorybusy
json_metadata{"app":"steemit\/0.1"}
created2019-10-25 13:43:30
last_update2019-10-25 13:43:30
depth1
children1
net_rshares0
last_payout2019-11-01 13:43:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length17
author_reputation36,963,899,244,133
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@beerlover ·
Command accepted!
properties (22)
post_id81,187,910
authorbeerlover
permlinkre-pzxngg-20191025t134356z
categorybusy
json_metadata{"app":"beem\/0.21.1"}
created2019-10-25 13:44:00
last_update2019-10-25 13:44:00
depth2
children0
net_rshares0
last_payout2019-11-01 13:44:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length17
author_reputation16,011,958,080,429
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@beerlover ·
<div class='pull-right'>https://cdn.steemitimages.com/DQmaHThyECGhEx8tSfHZbiMFRNYjJ35K92cDgiJjkzBUaJo/One%20sip%20of%20BEER%20for%20you.gif<p><sup><a href='https://steem-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br><br> <p> Hey @felixxx, here is a little bit of  <code>BEER</code> for you. Enjoy it!</p> </center>
properties (22)
post_id81,187,907
authorbeerlover
permlinkre-python-for-steem-how-to-beem-20191025t134347z
categorybusy
json_metadata{"app":"beem\/0.21.1"}
created2019-10-25 13:43:51
last_update2019-10-25 13:43:51
depth1
children0
net_rshares0
last_payout2019-11-01 13:43:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length362
author_reputation16,011,958,080,429
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@mytechtrail ·
I am more of a virtualbox user myself, but I also run Ubuntu 18.04 on my primary desktop computer anyways.

Very interested in where you take these posts as I would like to write some Python code to track and log my Steem data using some of the metrics that I manually get from steemworld.org and steemitboard.com currently.

You might also want to add a STEM tag to get some rewards from that community.

properties (22)
post_id81,192,105
authormytechtrail
permlinkre-felixxx-pzxur2
categorybusy
json_metadata{"tags":["busy"],"app":"steempeak\/1.19.0"}
created2019-10-25 16:21:54
last_update2019-10-25 16:21:54
depth1
children5
net_rshares0
last_payout2019-11-01 16:21:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length406
author_reputation7,244,359,600,749
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@felixxx · (edited)
I did not think of the STEM tag. I used up the 5 tags that busy.org allows me to use ... 

Depending on what you want to do, I could just work on that.

Which data do you need, how do you want it exported ?

edit: I wanted to take this all the way to SMT creation ...
properties (22)
post_id81,192,649
authorfelixxx
permlinkpzxvtt
categorybusy
json_metadata{"app":"steemit\/0.1"}
created2019-10-25 16:44:18
last_update2019-10-25 17:02:03
depth2
children3
net_rshares0
last_payout2019-11-01 16:44:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length267
author_reputation66,238,594,869,311
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@mytechtrail ·
I have tried reading the beem documentation and either do not understand enough Python to properly use it, or some of the stuff I want is not directly callable.

I think I replied to my comment to answer your original question so I do not know if you get notified.
properties (22)
post_id81,197,382
authormytechtrail
permlinkre-felixxx-pzy529
categorybusy
json_metadata{"tags":["busy"],"app":"steempeak\/1.19.0"}
created2019-10-25 20:04:36
last_update2019-10-25 20:04:36
depth3
children2
net_rshares0
last_payout2019-11-01 20:04:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length264
author_reputation7,244,359,600,749
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@mytechtrail ·
For now things like posts, comments, votes(received-given), SP vested, SP delegated and reputation. Eventually I would like to be able to run queries like who I have voted for and who has voted for me. I know there are many different web pages to get most of this, but as I am learning Python I would like the experience of writing the code myself.
properties (22)
post_id81,197,275
authormytechtrail
permlinkre-mytechtrail-pzy4s5
categorybusy
json_metadata{"tags":["busy"],"app":"steempeak\/1.19.0"}
created2019-10-25 19:58:33
last_update2019-10-25 19:58:33
depth2
children0
net_rshares0
last_payout2019-11-01 19:58:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length348
author_reputation7,244,359,600,749
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@bluerobo ·
Good stuff. Wanted to get started with that anyways. Now I'm taking the lazy route instead of tinkering myself :)
!BEER

Posted using [Partiko Android](https://partiko.app/referral/bluerobo)
properties (22)
post_id81,195,134
authorbluerobo
permlinkbluerobo-re-felixxx-python-for-steem-how-to-beem-20191025t181838038z
categorybusy
json_metadata{"app":"partiko","client":"android"}
created2019-10-25 18:18:39
last_update2019-10-25 18:18:39
depth1
children0
net_rshares0
last_payout2019-11-01 18:18:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length190
author_reputation11,540,436,142,415
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@flipstar ·
Ich danke dir vielmals.
properties (22)
post_id81,215,610
authorflipstar
permlinkpzzkwl
categorybusy
json_metadata{"app":"steemit\/0.1"}
created2019-10-26 14:43:33
last_update2019-10-26 14:43:33
depth1
children0
net_rshares0
last_payout2019-11-02 14:43:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length23
author_reputation148,669,616,868,095
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@revisesociology ·
Hey I'll look into this at some point - bit busy with work next few days but I'll check back for sure!

Posted using [Partiko Android](https://partiko.app/referral/revisesociology)
properties (22)
post_id81,223,098
authorrevisesociology
permlinkrevisesociology-re-felixxx-python-for-steem-how-to-beem-20191026t204659023z
categorybusy
json_metadata{"app":"partiko","client":"android"}
created2019-10-26 20:47:00
last_update2019-10-26 20:47:00
depth1
children0
net_rshares0
last_payout2019-11-02 20:47:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length180
author_reputation219,336,602,045,061
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steemchiller ·
$0.97
>ctrl+c, ctrl+v do not work like they do in Windows

Just in case you don't know:
In Linux terminal it works with `ctrl+shift+c` and `ctrl+shift+v`
👍  , , , , , , , , , , ,
properties (23)
post_id81,230,768
authorsteemchiller
permlinkq00roc
categorybusy
json_metadata{"app":"steemit\/0.1"}
created2019-10-27 06:07:24
last_update2019-10-27 06:07:24
depth1
children1
net_rshares4,240,375,972,272
last_payout2019-11-03 06:07:24
cashout_time1969-12-31 23:59:59
total_payout_value0.485 SBD
curator_payout_value0.484 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length147
author_reputation278,255,940,220,712
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (12)
@felixxx ·
No, I didn't know. 

To make matters worse: It works inside gedit.
properties (22)
post_id81,230,975
authorfelixxx
permlinkq00sdk
categorybusy
json_metadata{"app":"steemit\/0.1"}
created2019-10-27 06:22:33
last_update2019-10-27 06:22:33
depth2
children0
net_rshares0
last_payout2019-11-03 06:22:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length66
author_reputation66,238,594,869,311
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@beerlover ·
<div class='pull-right'>https://cdn.steemitimages.com/DQmaHThyECGhEx8tSfHZbiMFRNYjJ35K92cDgiJjkzBUaJo/One%20sip%20of%20BEER%20for%20you.gif<p><sup><a href='https://steem-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br><br> <p> Hey @felixxx, here is a little bit of  <code>BEER</code> for you. Enjoy it!</p> </center>
properties (22)
post_id81,428,751
authorbeerlover
permlinkre-python-for-steem-how-to-beem-20191103t151344z
categorybusy
json_metadata{"app":"beem\/0.21.1"}
created2019-11-03 15:13:48
last_update2019-11-03 15:13:48
depth1
children0
net_rshares0
last_payout2019-11-10 15:13:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length362
author_reputation16,011,958,080,429
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@beerlover ·
<div class='pull-right'>https://cdn.steemitimages.com/DQmaHThyECGhEx8tSfHZbiMFRNYjJ35K92cDgiJjkzBUaJo/One%20sip%20of%20BEER%20for%20you.gif<p><sup><a href='https://steem-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br><br> <p> Hey @felixxx, here is a little bit of  <code>BEER</code> for you. Enjoy it!</p> </center>
properties (22)
post_id81,428,755
authorbeerlover
permlinkre-python-for-steem-how-to-beem-20191103t151359z
categorybusy
json_metadata{"app":"beem\/0.21.1"}
created2019-11-03 15:14:03
last_update2019-11-03 15:14:03
depth1
children0
net_rshares0
last_payout2019-11-10 15:14:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length362
author_reputation16,011,958,080,429
root_title"Python for STEEM: How to beem"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000