create account

update for beem: add community support by holger80

View this thread on: hive.blogpeakd.comecency.com
· @holger80 ·
$67.68
update for beem: add community support
## Repository

https://github.com/holgern/beem<center>
![beem-logo](https://cdn.steemitimages.com/DQmcRrwLPSywSYMierfP6um6mejeMNGjN9Rxw7audJqTDgb/beem-logo)
</center>

[beem](https://github.com/holgern/beem) is a python library and command line tool for HIVE.  The current version is 0.24.5.

There is also a discord channel for beem: https://discord.gg/4HM592V

The newest beem version can be installed by:

```
pip install -U beem
```

Check that you are using hive nodes. The following command 

```
beempy updatenodes --hive
```

updates the nodelist and uses only hive nodes. After setting hive as default_chain, `beempy updatenodes` can be used.

The list of nodes can be checked with

```
beempy config
```

and

```
beempy currentnode
```

shows the currently connected node.

## Changelog for versions 0.24.5
* replace percent_hive_dollars by percent_hbd (to make beem HF24 ready)
* Remove whaleshares related code 
* Fix adding of a wif in beempy
* Remove SteemConnect
* Fix set token in HiveSigner
* Add Blurt
* Add Community for community reladed requests and broadcasts
* Improve community lookup for beempy createpost
* Improved beempy history command output
* Improved beempy stream
  
## Community support
I added community support to beem. The following example shows the content of a community dict:


```
from beem.community import Community
from prettytable import PrettyTable
community = Community("hive-139531")
t = PrettyTable(["key", "value"])
t.align = "l"
t._max_width = {"value" : 60}
for key in community.json():
    t.add_row([key, community.json()[key]])
print(t)
```
returns
```
+-------------+--------------------------------------------------------------+
| key         | value                                                        |
+-------------+--------------------------------------------------------------+
| id          | 1357761                                                      |
| name        | hive-139531                                                  |
| title       | HiveDevs                                                     |
| about       | HiveDevs - A community of developers working on Hive related |
|             | projects. Visit our Discord at https://discord.gg/cvnByhu    |
| lang        | en                                                           |
| type_id     | 1                                                            |
| is_nsfw     | False                                                        |
| subscribers | 1005                                                         |
| sum_pending | 638                                                          |
| num_pending | 253                                                          |
| num_authors | 120                                                          |
| created_at  | 2020-01-23 16:27:39                                          |
| avatar_url  |                                                              |
| context     | {}                                                           |
| description |                                                              |
| flag_text   |                                                              |
| settings    | {}                                                           |
| team        | [['hive-139531', 'owner', ''], ['netuoso', 'admin', ''],     |
|             | ['abit', 'mod', ''], ['roadscape', 'mod', ''], ['acidyo',    |
|             | 'mod', ''], ['gtg', 'mod', ''], ['good-karma', 'mod',        |
|             | 'Founder of Esteem'], ['jesta', 'mod', ''], ['inertia',      |
|             | 'mod', '#1138'], ['arcange', 'mod', ''], ['someguy123',      |
|             | 'mod', ''], ['mahdiyari', 'mod', ''], ['blocktrades', 'mod', |
|             | ''], ['drakos', 'mod', ''], ['themarkymark', 'mod', ''],     |
|             | ['stoodkev', 'mod', ''], ['therealwolf', 'mod', ''],         |
|             | ['yabapmatt', 'mod', ''], ['eonwarped', 'mod', ''],          |
|             | ['emrebeyler', 'mod', ''], ['bobinson', 'mod', ''],          |
|             | ['asgarth', 'mod', ''], ['quochuy', 'mod', 'Witness'],       |
|             | ['crimsonclad', 'mod', ''], ['pharesim', 'mod', '']]         |
+-------------+--------------------------------------------------------------+
```
The following API functions have been implemented:

```
roles = community.get_community_roles()
print("len %d - first entry: %s" % (len(roles), str(roles[0])))
subscribers = community.get_subscribers()
print("len %d - first entry: %s" % (len(subscribers), str(subscribers[0])))
last_activity = community.get_activities(limit=100, last_id=None)
print("len %d - first entry: %s" % (len(last_activity), str(last_activity[0])))
latest_post = community.get_ranked_posts(limit=25)
print("len %d - first entry: %s" % (len(latest_post), str(latest_post[0])[:120]))
```
returns:
```
len 50 - first entry: ['hive-139531', 'owner', '']
len 250 - first entry: ['joshman', 'guest', None, '2020-07-14 16:16:15']
len 100 - first entry: {'id': 78159733, 'type': 'subscribe', 'score': 35, 'date': '2020-07-14T16:16:15', 'msg': '@joshman subscribed to HiveDevs', 'url': 'trending/hive-139531'}
len 25 - first entry: {'post_id': 83702748, 'author': 'netuoso', 'permlink': 'creation-of-steemdevs-community-information-about-steemdevs', 'c

```

`get_subscribers()` returns only 250 subscribers and it is currently not possible to receive all subscribers (`hive-139531` has 1005 subscribers in total). A way to receive all subscribers could be parsing `get_activities`, as there is an entry for each new subscriber.

## Communities
`Communities` returns a list of registred communities. The communities inside the list can be printed by `printAsTable()` and it is possible to search the community title for a match:
```
from beem.community import Communities
communities = Communities(limit=100)
communities.search_title("dev").printAsTable()
```
returns
```
+-----+-------------+----------+------+-------------+-------------+-------------+-------------+
| Nr. | Name        | Title    | lang | subscribers | sum_pending | num_pending | num_authors |
+-----+-------------+----------+------+-------------+-------------+-------------+-------------+
| 1   | hive-139531 | HiveDevs | en   | 1000        | 945         | 236         | 113         |
+-----+-------------+----------+------+-------------+-------------+-------------+-------------+
```
The limit of returned communities can be increased by using the `limit` parameter:
```
from beem.community import Communities
communities = Communities(limit=1000)
communities.search_title("dev").printAsTable()
```
returns
```
+-----+-------------+---------------+------+-------------+-------------+-------------+-------------+
| Nr. | Name        | Title         | lang | subscribers | sum_pending | num_pending | num_authors |
+-----+-------------+---------------+------+-------------+-------------+-------------+-------------+
| 1   | hive-139531 | HiveDevs      | en   | 1000        | 945         | 236         | 113         |
| 2   | hive-152825 | DEVCOIN       | en   | 2           | 0           | 5           | 2           |
| 3   | hive-199094 | Devotionals   | en   | 1           | 0           | 3           | 1           |
| 4   | hive-192808 | kr-dev-center | kr   | 20          | 0           | 0           | 0           |
| 5   | hive-150008 | Game Dev   | en   | 12          | 0           | 0           | 0           |
| 6   | hive-101482 | BeeWiki.Dev   | en   | 6           | 0           | 0           | 0           |
+-----+-------------+---------------+------+-------------+-------------+-------------+-------------+
```
Searching a community by its title was also added to `beempy createpost`
![](https://images.hive.blog/DQmUZ5J5Z4ov6aXobXunqGybcdkdiVHui5Y8jJ58MNVVKpY/image)
Currently a title is searched in the top 1000.

## Broadcasting community related ops
The following shows all operation that can be broadcasted:
```
from beem.community import Community
community = Community("hive-111111")
community.set_role("account_a", "mod", "new mod")
community.set_user_title("account_b", "investor")
community.mute_post("author_a", "permlink_a", "spam", "mod_a")
community.unmute_post("author_a", "permlink_a", "no spam", "mod_a")
community.update_props("My Community", "Great community", False, "About me", "Not about me", "admin_a")
community.subscribe("user_c")
community.unsubscribe("user_c")
community.pin_post("author_a", "permlink_a", "mod_a")
community.unpin_post("author_a", "permlink_a", "mod_a")
community.flag_post("author_a", "permlink_a", "please check", "user_a")
```

## HiveSigner / steemconnect
I removed the SteemConnect class from beem, as steemconnect.com is no longer working.

I fixed the token parameter in HiveSigner:
```
from beem.HiveSigner import HiveSigner
hs = HiveSigner(token=["32..."])
print(hs.me())
```
where 32... is a valid HiveSinger token.

## Improved beempy stream

```
beempy stream -t -f
```
retuns now a table for each block:
```
+----------+---------+-------------+------------------------------------------------------+
| blocknum | trx_num | type        | content                                              |
+----------+---------+-------------+------------------------------------------------------+
| 45157440 | 0       | custom_json | sm_submit_team                                       |
| 45157440 | 1       | custom_json | sm_find_match                                        |
| 45157440 | 2       | vote        | 100.00% @mattsanthonyit/uty6wgup4ul - mattsanthonyit |
| 45157440 | 3       | custom_json | sm_find_match                                        |
| 45157440 | 4       | custom_json | sm_find_match                                        |
| 45157440 | 5       | custom_json | sm_find_match                                        |
| 45157440 | 6       | custom_json | sm_find_match                                        |
| 45157440 | 7       | custom_json | sm_find_match                                        |
| 45157440 | 8       | custom_json | sm_find_match                                        |
| 45157440 | 9       | custom_json | sm_submit_team                                       |
| 45157440 | 10      | custom_json | sm_submit_team                                       |
| 45157440 | 11      | custom_json | sm_find_match                                        |
| 45157440 | 12      | custom_json | sm_find_match                                        |
| 45157440 | 13      | custom_json | sm_find_match                                        |
| 45157440 | 14      | custom_json | scot_claim_token                                     |
| 45157440 | 15      | vote        | 5.00% @xr-hammergaming/52ktvx97870 - innerhive       |
| 45157440 | 16      | custom_json | sm_find_match                                        |
+----------+---------+-------------+------------------------------------------------------+
```
where custom_json, vote, transfer and transfer_to_vesting have a shortened output.
```
beempy stream -f
```
streams the output in raw format.

## Blurt
As some beem users were interested in using beem on blurt, I added a Blurt class to beem. This adds support for blurt to beempy.
The following commands will change the nodes, and check if they are set
```
beempy updatenodes --blurt
beempy config
```
It is then possible to check the amount of powered up BLURT and to power it down by
```
beempy power holger80
beempy powerdown -a holger80 33244
```
The powerdown command will ask for your active keys. 

You can check the activity on blurt by
```
beempy stream -t
```
you need to be patient, as there is currently not much activity...:
```
{'block_num': 306762,
 'op': ['withdraw_vesting',
        {'account': 'oth1',
         'vesting_shares': {'amount': '36699505048',
                            'nai': '@@000000037',
 'timestamp': '2020-07-14T21:53:57',
 'trx_num': 0}
{'block_num': 306765,
 'op': ['vote',
        {'author': 'discernente',
         'permlink': '0alhcnfp0r7dh2t',
         'voter': 'discernente',
         'weight': 10000}],
 'timestamp': '2020-07-14T21:54:06',
 'trx_num': 0}
 ```
You can switch back to hive with:
```
beempy updatenodes --hive
```
The Blurt class can be used to simplify the access to the Blurt blockchain:
```
from beem import Blurt
blurt = Blurt(node= ["https://rpc.blurt.world", "https://blurt-rpc.steem.buzz"])
print(blurt)
```
returns
```
<Blurt node=https://rpc.blurt.world, nobroadcast=False>
```

___

*If you like what I do, consider casting a vote for me as witness on [Hivesigner](https://hivesigner.com/sign/account-witness-vote?witness=holger80&approve=1) or on [PeakD](https://peakd.com/witnesses)*
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 494 others
👎  ,
properties (23)
authorholger80
permlinkupdate-for-beem-add-community-support
categoryhive-139531
json_metadata"{"canonical_url": "https://hive.blog/hive-139531/@holger80/update-for-beem-add-community-support", "community": "hive-139531", "app": "beempy/0.24.5", "users": ["mattsanthonyit", "joshman", "xr-hammergaming"], "links": ["https://hivesigner.com/sign/account-witness-vote?witness=holger80&approve=1", "https://discord.gg/4HM592V", "https://blurt-rpc.steem.buzz", "https://peakd.com/witnesses", "https://images.hive.blog/DQmUZ5J5Z4ov6aXobXunqGybcdkdiVHui5Y8jJ58MNVVKpY/image", "https://cdn.steemitimages.com/DQmcRrwLPSywSYMierfP6um6mejeMNGjN9Rxw7audJqTDgb/beem-logo", "https://rpc.blurt.world", "https://rpc.blurt.world,", "https://github.com/holgern/beem", "https://discord.gg/cvnByhu"], "tags": ["development", "beem", "python", "community"]}"
created2020-07-14 22:12:51
last_update2020-07-14 22:12:51
depth0
children8
last_payout2020-07-21 22:12:51
cashout_time1969-12-31 23:59:59
total_payout_value38.848 HBD
curator_payout_value28.836 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length12,705
author_reputation358,857,509,568,825
root_title"update for beem: add community support"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,523,092
net_rshares190,776,545,484,954
author_curate_reward""
vote details (560)
@attajuttjj ·
thanks for the update I'm gonna start working too
properties (22)
authorattajuttjj
permlinkre-holger80-qdit54
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.07.1"}
created2020-07-15 17:13:06
last_update2020-07-15 17:13:06
depth1
children0
last_payout2020-07-22 17:13: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_length49
author_reputation1,450,650,803,206
root_title"update for beem: add community support"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,537,094
net_rshares0
@hivebuzz ·
Congratulations @holger80! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://images.hive.blog/60x60/http://hivebuzz.me/badges/toppayoutday.png"></td><td>Your post got the highest payout of the day</td></tr>
</table>

<sub>_You can view [your badges on your board](https://hivebuzz.me/@holger80) And compare to others on the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Do not miss the last post from @hivebuzz:**
<table><tr><td><a href="/hivebuzz/@hivebuzz/hivewhale"><img src="https://images.hive.blog/64x128/https://i.imgur.com/rEHA937.png"></a></td><td><a href="/hivebuzz/@hivebuzz/hivewhale">Hive Whale - Make it spray and get your badge!</a></td></tr></table>

###### Support the HiveBuzz project. [Vote](https://hivesigner.com/sign/update_proposal_votes?proposal_ids=%5B%22109%22%5D&approve=true) for [our proposal](https://peakd.com/me/proposals/109)!
properties (22)
authorhivebuzz
permlinkhivebuzz-notify-holger80-20200716t002854000z
categoryhive-139531
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2020-07-16 00:28:54
last_update2020-07-16 00:28:54
depth1
children0
last_payout2020-07-23 00:28:54
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_length1,063
author_reputation369,409,851,606,973
root_title"update for beem: add community support"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,542,875
net_rshares0
@mattsanthonyit ·
$0.04
Great job my friend @holger80, I was about to go to bed when I saw this notification pop up. You are a genius for short. Keep it up. We need people like you here more than ever. Greetings from Ilorin Nigeria 🇳🇬. Good night. 
👍  
👎  
properties (23)
authormattsanthonyit
permlinkre-holger80-qdhe7e
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.07.1"}
created2020-07-14 22:52:30
last_update2020-07-14 22:52:30
depth1
children0
last_payout2020-07-21 22:52:30
cashout_time1969-12-31 23:59:59
total_payout_value0.022 HBD
curator_payout_value0.022 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length224
author_reputation1,624,688,404,517,341
root_title"update for beem: add community support"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,523,561
net_rshares213,453,926,264
author_curate_reward""
vote details (2)
@mattsanthonyit ·
Followed you few weeks ago 🙌
properties (22)
authormattsanthonyit
permlinkre-holger80-qdhe8v
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.07.1"}
created2020-07-14 22:53:21
last_update2020-07-14 22:53:21
depth1
children0
last_payout2020-07-21 22:53:21
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_length28
author_reputation1,624,688,404,517,341
root_title"update for beem: add community support"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,523,571
net_rshares0
@maxuvv ·
Hi @holger80, you have received a small bonus upvote from MAXUV.
This is to inform you that you now have [new MPATH tokens](https://hive-engine.com/?p=market&t=MPATH) in your Hive-Engine wallet.
Please [read this post](https://peakd.com/hive-167922/@mpath/mpath-weekly-report-and-token-distribution-26-april-2020) for more information.
Thanks for being a member of both MAXUV *and* MPATH!
properties (22)
authormaxuvv
permlinkre-update-for-beem-add-community-support-20200714t221452z
categoryhive-139531
json_metadata"{"app": "rewarding/0.1.0"}"
created2020-07-14 22:14:54
last_update2020-07-14 22:14:54
depth1
children0
last_payout2020-07-21 22:14:54
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_length393
author_reputation32,074,948,443
root_title"update for beem: add community support"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,523,126
net_rshares0
@scorer ·
$0.05
> Remove whaleshares related code

Is whaleshares project dead? Their website was down for a week, but now it is back.
👍  
👎  
properties (23)
authorscorer
permlinkqdhzfw
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2020-07-15 06:31:09
last_update2020-07-15 06:31:09
depth1
children1
last_payout2020-07-22 06:31:09
cashout_time1969-12-31 23:59:59
total_payout_value0.022 HBD
curator_payout_value0.023 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length118
author_reputation5,082,149,757,589
root_title"update for beem: add community support"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,528,669
net_rshares213,664,612,478
author_curate_reward""
vote details (2)
@holger80 ·
$0.02
The WLS chain id is still included into beem. I removed related code for broadcasting, as whaleshares differs to strongly from the current hive codebase and the current implementation was not clean. 
👍  , , , , , , ,
properties (23)
authorholger80
permlinkre-scorer-qdi3i0
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.07.1"}
created2020-07-15 07:58:54
last_update2020-07-15 07:58:54
depth2
children0
last_payout2020-07-22 07:58:54
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length199
author_reputation358,857,509,568,825
root_title"update for beem: add community support"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,529,606
net_rshares121,893,254,628
author_curate_reward""
vote details (8)
@slashformotion ·
awesome work
properties (22)
authorslashformotion
permlinkre-holger80-qdkxqe
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2020.07.1"}
created2020-07-16 20:47:03
last_update2020-07-16 20:47:03
depth1
children0
last_payout2020-07-23 20:47: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_length12
author_reputation2,410,764,686,560
root_title"update for beem: add community support"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,559,570
net_rshares0