dappcoder avatar

installs beem by Anaconda and develops a python robot of steem

dappcoder

Published: 25 Jan 2020 › Updated: 25 Jan 2020installs beem  by  Anaconda and develops a python robot of steem

installs beem by Anaconda and develops a python robot of steem

anaconda.jpeg

The advantage of beem is that it can automatically find the available steem server nodes. Most of the time, you don't need to worry about network access
屏幕快照 2020-01-25 上午11.50.15.png

The advantage of anaconda is that it manages Python development environment across platforms. Whether you are a Windows developer or a Linux / Mac developer, the basic operations are almost the same.

This post takes MacOS as an example (Windows / Linux is not verified)

Anaconda, an open-source Python package manager: anaconda is an open-source Python distribution version, including hundreds of scientific packages and dependent packages such as CONDA, python, numpy, panda, etc. the download file is relatively large (> 500 MB). If you want to save bandwidth or storage space, you can use miniconda, a small distribution (only including CONDA and python), and then install the required packages separately according to your needs.

Beem: it is an unofficial Python Library of steem. From python-bitshares, it contains a handy command-line tool, beempy.

Installation of Anaconda3 in Mac

The running environment of beem tool requires anaconda3 (Python 3). If the official download of anaconda is too slow, you can use the image of Tsinghua University:

$ cd ~
$ wget https://repo.anaconda.com/archive/Anaconda3-2019.10-MacOSX-x86_64.sh
$ bash Anaconda3-2019.10-MacOSX-x86_64.sh
$ source ~/.bash_profile
$ conda activate
(base) ~$ python -V
(base) ~$ pip -V 

Exit anaconda3 environment:(base) ~$ conda deactivate

Anaconda3 installing beem

$ cd ~
$ conda activate
(base) ~$ conda config --add channels conda-forge 
(base) ~$ conda install beem 
(base) ~$ conda install cryptography  

Using beempy

Fastest node to use: $beempy pingnode -- sort
Create local wallet password: $beempy createwallet
View wallet information: $$beempy walletinfo

+-----------------------+--------------------------------------------+
| Key                   | Value                                      |
+-----------------------+--------------------------------------------+
| created               | True                                       |
| locked                | True                                       |
| Number of stored keys | 0                                          |
| sql-file              | /home/xy/.local/share/beem/beem.sqlite |
| password_storage      | environment                                |
| UNLOCK env set        | no                                         |
| keyring installed     | yes                                        |
+-----------------------+--------------------------------------------+

Change local wallet password: $beempy changewalletpassphrase
Add steem account: $beempy addkey
Delete the steem account: beempy delkey [options] public_key
Check the steim account in the wallet: $beempy listaccounts

+-----------+---------+-------------------------------------------------------+
| Name      | Type    | Available Key                                         |
+-----------+---------+-------------------------------------------------------+
| maxxxxnk | active  | STMxxxxxx9dvE |
| manbbbbnk | posting | STM87YzixbssssEDKXfU |
+-----------+---------+-------------------------------------------------------+

Query balance: $beempy balance maxxxxnk manbbbbnk

Demonstrate a robot (demo. Py) that show the currently posts on steem blockchain:

from __future__ import print_function
import sys
from datetime import timedelta
import time
import io
from beem.blockchain import Blockchain
from beem.utils import parse_time

if __name__ == "__main__":
    blockchain = Blockchain()
    for vote in blockchain.stream(opNames=["comment"]):
        print(vote)

Execute program: $python demo.py
Printed information:

{'type': 'comment', 'parent_author': 'munaib', 'parent_permlink': 'poll-many-in-us-support-trump-decision-to-kill-iran-general', 'author': 'steemcleaner', 'permlink': 'steemcleaner-re-munaibpoll-many-in-us-support-trump-decision-to-kill-iran-general', 'title': '', 'body': 'Warning! This user is on our black list, likely as a known plagiarist, spammer or ID thief. Please be cautious with this post!\nIf you believe this is an error, please chat with us in the #appeals channel in [our discord](https://discord.gg/7FkETjJ).', 'json_metadata': '', '_id': '69548f80e7dffd82fc37a861e42169057df0957e', 'timestamp': datetime.datetime(2020, 1, 25, 3, 46, 15, tzinfo=<UTC>), 'block_num': 40226710, 'trx_num': 40, 'trx_id': '33e920525f1bfd984b961b645d9aab7e7748f059'}

中文版原文:Anaconda 安装 beem,开发 python版本的 steem 机器人
.

Leave installs beem by Anaconda and develops a python robot of steem to:

Written by

Read more #hive-143316 posts


Best Posts From dappcoder

We have not curated any of dappcoder's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From dappcoder