New to Busy?

How to run beem/beempy in your browser with repl.it

16 comments

holger80
74
last month3 min read

It is now possible to run beem/beempy directly in your browser without installing python or beem. If you always wanted to play with beem/beempy but never managed it to install it then this is your chance. You can now try beem/beempy directly in your browser.

You should never enter any private keys into repl.it, so this can be used for scripts or beempy commands that receives data from the HIVE blockchain.

How to run beempy in your browser

Go to the beem github and click on the run with repl.it image.

You can also directly click on this link run beem/beempy with repl.it.

Now you have to wait until it finished cloning the repo:

Cloning beem

If you click now on run, beem is installed and beempy is started. This needs some time.

Starting beempy

You could also install and run it by entering:

python setup.py install
beempy

into the terminal.

You can now try different beempy commands.
For example

set default_account holger80
updatenodes
power

Using beempy

Running a script in your browser

If not already installed, you need to install beem with

python setup.py install

I added a small example to the examples directory which can be used to learn more about your followers. You find the script here.

The script can be started with two parameters. The first parameter is the account name and the second parameter is the number of the latest blogs that should be taken into account (must be <=100). It is a good idea to select the fastest node by beempy updatenodes first.

beempy updatenodes
python examples/check_followers holger80 20

Run the command

The script goes now through my last 20 posts and checks which vote and which reply was made by my followers. A ghost follower is someone who did not vote or left any comment on my posts but is active. Active means that the account had voted or wrote comments within the last 30 days.

Results

Installing beem to a fresh repl.it

You can also create a fresh python repl.it by going to python3 repl.it.
beem can be installed by going to the package tab to the left and enter beem:

It will be installed when you press the plus button.

To get started, you can add the following to the empty main.py:

from beem.account import Account
from beem import Hive

hive = Hive("https://api.hive.blog")

acc = Account("holger80", blockchain_instance=hive)
print(acc.vp)

It should look now:

and press run. You should see now my vote power.


Have fun and remember not to enter your private keys into the repl.it terminal or your scripts stored at repl.it.


If you like what I do, consider casting a vote for me as witness on Hivesigner or on PeakD

Comments

Sort byBest