update for beem: add community support
hive-139531·@holger80·
0.000 HBDupdate for beem: add community support
## Repository
https://github.com/holgern/beem<center>

</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`

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)*👍 eval, kgswallet, sam99, ronak10, laissez-faire, everyoung, elleok, onealfa, swedishdragon76, crokkon, techslut, glastar, alexanderfluke, amico, dera123, saboin, maxuvv, abh12345, gerber, steemcityrewards, polish.hive, jayna, deathwing, emrebeyler, nealmcspadden, philnewton, cryptoandcoffee, battlegames, huaren.news, dcityrewards, taitux, felander, yogacoach, cadawg, pkocjan, swisswitness, dalz, engrave, milu-the-dog, steem.leo, goodreader, mice-k, staryao, hivecur, ezzy, exyle, d-pend, shitsignals, accelerator, purefood, chronocrypto, bestboom, freddio, gallerani, dlike, triptolemus, bobby.madagascar, determine, permaculturedude, sm-silva, freddio.sport, zaku-pal, asteroids, one.life, maxuvd, chartreader, mys, dkid14, unconditionalove, themightyvolcano, arkmy, reverendrum, ldp, mannaman, mfblack, dappcoder, piratedice, dpend.active, folklure, sketching, nicniezgrublem, glodniwiedzy, angatt, flyingbolt, firefuture, zaku-leo, blocktvnews, dune69, rycharde, caladan, steembasicincome, followjohngalt, steemindian, triplea.bot, therealyme, ribary, kiokizz, fbslo, beleg, iseeyouvee, ifunnymemes, hivecur2, whd, benedict08, sbi2, julian2013, gorbisan, shebe, anikys3reasure, hungryharish, sbi-tokens, qwertm, approximate, kiobot, jimcustodio, sbi3, sm-lvl1, darhainer, plankton.token, espni, ew-and-patterns, mermaidvampire, sweetkathy, sbi4, mistia, askari, gerbo, revisesociology, phortun, sbi5, musinka, florino, petrvl, onlavu, sbi6, ticketyboo, ticketywoof, borbina, belahejna, kryptoformator, asa-raw, sbi7, libuska, sbi8, triviummethod, lelon, onetin84, jpphotography, abitcoinskeptic, casberp, whack.science, erikah, pagliozzo, sbi9, brucutu2, ilovecanada, mcoinz79, therealwolf, spamfarmer, cyrillo, thegambit, sbi10, smartsteem, nokodemion, bilpcoinrecords, hiveonboard, tombstone, moneytron, markkujantunen, nobyeni, hasmez, daath, tubiska, kitty-kitty, cpt-sparrow, epicdice, tinyhousecryptos, ninnu, borran, gadrian, gagago, carlpei, carioca, tarazkp, thrasher666, pocoto, imbartley, slider2990, brucutu1, jussara, iamjohn, abh12345.medi, satren, babytarazkp, monsterjamgold, ronavel, danielsaori, sepracore, blockchainpeople, avel692, bluerobo, shadflyfilms, onepercentbetter, ronaldoavelino, slobberchops, brucutu, hanke, blue-witness, gamer00, bobskibob, maxer27, chrismadcboy2016, actifit-peter, kibela, anech512, akifane, urdreamscometrue, realgoodcontent, votebetting, sharker, lemouth, isnochys, daisyphotography, marcus0alameda, solarwarrior, goodcontentbot, hivebuilderteam, jongolson, broxi, thranax, merlion, hungrybear, fractalnode, offgridlife, bubke, ericburgoyne, russellstockley, lesmouths-travel, cultus-forex, besheda, forecasteem, midnightoil, blackbunny, exec, blacklux, codingdefined, oflyhigh, helene, lingfei, gunthertopp, tipu, sudefteri, alitavirgen, fw206, digital.mine, xiaohui, mxzn, happy-soul, stefannikolov, kahvesizlik, vida-blanca, wherein, mia-cc, kryptogames, bcm, laoyao, somebody, yulan, condeas, cnstm, mytechtrail, gerdtrudroepke, linuxbot, likuang007, lianjingmedia, condeas.pal, tabea, freebornsociety, jacekw, fulcrumleader, arcange, jerrybanfield, bronkong, anli, andrepol, candyboy, maxpatternman, inteligente, re2pair, detetive, traduzindojogos, sm-skynet, dachcolony, ctl001, uwelang, redouanemez, flugschwein, matschi, leeyh, eunsik, dreimaldad, furioslosi, richie.rich, blue.rabbit, dollarbills, fengchao, superlao, szf, raspibot, leeyh3, kr-coffeesteem, steempearls, rehan12, liverpool-fan, cst90, a-bot, smon-joa, properfraction, kingscrown, flemingfarm, likwid, drorion, justyy, promobot, policewala, losi, backinblackdevil, moneybaby, leighscotford, andylein, raphaelle, lauchmelder, enki, alinalazareva, oadissin, idiosyncratic1, canercanbolat, hamsa.quality, bartheek, agathusia, oxoskva, bashadow, curationvoter, zerofive, leeyh2, fooblic, marryiv, naltedtirt, longer, mark-waser, digital-wisdom, ethical-ai, jwaser, bwaser, ellepdub, herpetologyguy, morgan.waser, handyman, strong-ai, technoprogressiv, funnyman, holycow2019, vaansteam, linnyplant, tonalddrump, starrouge, kissi, captain.kirk, circa, korinkrafting, drsensor, mattsanthonyit, soyrosa, hivewatchers, logic, steemcleaners, mineopoly, mcsagel, artjohn, bewithbreath, skepticology, tomoyan, donkeyzhang, steempty, fminerten, goumao, wf9877, paullifefit, dobro2020, hasni007, simplegame, scotauto, dhimmel, finex, sonder-an, busy.pay, busy.org, aggroed, blockchainstudio, ace108, hope-on-fire, majoboa18, mountaingod, hellohive, jphamer1, drew0, timcliff, eliasseth, idkpdx, curationstudio, maryincryptoland, aquinotyron3, abbenay, bluewall, baiboua, nalexadre, puza, kriang3tee, imtase, akioexzgamer, french-tech, yuza, paopaoza, ten-years-before, univers.crypto, steementertainer, crypto.story, mintrawa, jamesbattler, oliverschmid, s9211, softworld, santigs, actnearn, rollinshive, yoogyart, scorer, sudutpandang, julialee66, hjlee119, hongdangmu, green-finger, bcm.dblog, okean123, avisk, nadhora, romanreigns, lrekt01, tradingideas, afukichi, tina-tina, happiness19, smon-fan, louisthomas, jewel-lover, ssc-token, smonbear, tr77, sm-jewel, smoner, smonian, jjangjjanggirl, dnflsms, jessy22, keepit2, keep-keep, gdhaetae, tradingideas.spt, tradingideas2, smonia, twinner, dein-problem, evildeathcore, rz1996, denizcakmak, reza-shamim, pixie333, ssekulji, udabeu, mehmetfix, simba, futurecurrency, cotarelo, aanjz09123, diegor, mutabor78, jedigeiss, landshutbrauhaus, giuatt07, judasp, gulf41, goldindigo, ttg, cloris, shaotech, jexus77, dikshabihani, afrikablr, jeanpi1908, j-p-bs, stickstore, quekery, steemcartel, hiq, smooms, holger80, fullnodeupdate, feelx, achmdfaisal, recoveryinc, gitplait, tykee, kamchore, bala41288, saviour98, lucianav, elevator09, espoem, stuntman.mike, carita-feliz, samscalet, hwangmadam, xr-hammergaming, donald.porter, binkyprod, kyju, my451r, solips, haejin, jjal, davidesimoncini, jkramer, zakia, tr777, pvinny69, manniman, marius19, schlafhacking, sekhet, slashformotion, obvious, investingpennies, photohunter4, photohunter5, seekingalpha, knightsunited, gavinatorial, oniemaniego, muntaharaceh, sportsbuddy, kendewitt, garybilbao, inertia, arabisouri, maskur2840, ahmedsy, marymi, irynochka, mrsyria, ibc,