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

in #hive-1083652 months ago (edited)

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

Sort:  

Amazing!!

It just gets better all the time.

I have picked your post for my daily hive voting initiative, Keep it up and Hive On!!

I'm guessing it must run on a Python virtual machine that's been compiled into WebAssembly, if it runs in the browser without needing to actually install it.

It doesn't actually run the whole operating system inside the browser... It's kind of shell session displayed on browser like when you connect to a virtual private server account without using external ssh application.

I did a simple test and got "242.126.223.35.bc.googleusercontent.com" as hostname.

Awsome post

Wow, it's great to now and a great work

Thank you for sharing what you do. It inspires me to keep learning about "beem". I have enough material to study and practice. This publication and the previous one are great

damn cool...
and again a great job!

Thanks for the tutorial I have been interested in coding and am currently going for a degree in cybersecurity

I like all these new things but I would also appreciate more application for the mobile phones. Thank you for your hard work.

Sent it to a Hive friend that knows about these things Lol.
I know about charity work, but Python sounds like a snake to me hahaha
Thank you.

@holger80, Just want to know if Rewarding.app Tool is live and running on the Hive Blockchain or not?

Have a great time ahead and stay blessed.

I think it will be safe and better.

Hi @holger80, you have received a small bonus upvote from MAXUV.
This is to inform you that you now have new MPATH tokens in your Hive-Engine wallet.
Please read this post for more information.
Thanks for being a member of both MAXUV and MPATH!