Let me preface this by saying:
beem is the shit, no doubt
Thanks @holger80; it is the best Python library for HIVE (and STEEM).
That being said, this is what I get when I try getting an account's info:
code:
from beem.account import Account
account_name = 'holger80'
account = Account(account_name)
for property in account:
print(property, account[property])
result:
id 538086
name holger80
owner {'weight_threshold': 1, 'account_auths': [], 'key_auths': [['STM5XDYn3NeTqiMd1wczZjF9sPiJqY2uQw9HRwT6LR6rQytAxWNfz', 1]]}
active {'weight_threshold': 1, 'account_auths': [], 'key_auths': [['STM7tA7Mh81wJV1J8eW8NyGLc3XCSyXNdFnhAh8F8bYYd8yAcy6Ew', 1]]}
posting {'weight_threshold': 1, 'account_auths': [['dapplr', 1], ['downvote-tool', 1], ['dpoll.xyz', 1], ['ecency.app', 1], ['engrave.app', 1], ['esteemapp', 1], ['nerday.app', 1], ['peakd.app', 1], ['piggy-bubba', 1], ['rewarding', 1]], 'key_auths': [['STM6t5ExkHZtQL1pdkrRZjCgzbAdnB3YUYCZgrYWDXvdnU5bp57jL', 1]]}
memo_key STM6MQBLaX9Q15CK3prXoWK4C6EqtsL7C4rqq1h6BQjxvfk9tuT3N
json_metadata {"profile":{"name":"Holger","about":"beem Developer, Steem Witness, beempy.com, steemrewarding.com","website":"https://github.com/holgern/beem","location":"Germany","cover_image":"
,"profile_image":"
,"witness_description":"Developer of several python libs: beem/beempy, steemengine and maker of steemrewarding.com, beempy.com and fullnodeupdate. Developer of Scot and part of the Nextcolony team. ","dtube_pub":"2AXePjH4fW35mjcrFMxC8rf4nkG4Yao2nUHq6XETxb7gP"}}
posting_json_metadata {"profile":{"name":"Holger","about":"beem Developer, Hive Witness, beempy.com, rewarding.app","website":"https://github.com/holgern/beem","location":"Germany","cover_image":"
,"profile_image":"
,"witness_description":"Developer of several python libs: beem/beempy, hiveengine and maker of rewarding.app and fullnodeupdate. ","dtube_pub":"2AXePjH4fW35mjcrFMxC8rf4nkG4Yao2nUHq6XETxb7gP","version":2}}
proxy
last_owner_update 1970-01-01 00:00:00+00:00
last_account_update 2020-12-28 22:09:06+00:00
created 2017-12-29 10:07:45+00:00
mined False
recovery_account recovery.account
last_account_recovery 1970-01-01 00:00:00+00:00
reset_account null
comment_count 0
lifetime_vote_count 0
post_count 1525
can_vote True
voting_manabar {'current_mana': '147684609966928', 'last_update_time': 1628148321}
downvote_manabar {'current_mana': '36921152491731', 'last_update_time': 1628148321}
balance 0.105 STEEM
savings_balance 0.000 STEEM
hbd_balance 0.114 SBD
hbd_seconds 73555602
hbd_seconds_last_update 2021-06-28 08:32:06+00:00
hbd_last_interest_payment 2021-06-07 08:42:12+00:00
savings_hbd_balance 0.000 SBD
savings_hbd_seconds 0
savings_hbd_seconds_last_update 1970-01-01 00:00:00+00:00
savings_hbd_last_interest_payment 1970-01-01 00:00:00+00:00
savings_withdraw_requests 0
reward_hbd_balance 0.000 SBD
reward_hive_balance 0.000 STEEM
reward_vesting_balance 328436.791168 VESTS
reward_vesting_hive {'amount': '175112', 'precision': 3, 'nai': '@@000000021'}
vesting_shares 147684609.966928 VESTS
delegated_vesting_shares 0.000000 VESTS
received_vesting_shares 0.000000 VESTS
vesting_withdraw_rate 0.000000 VESTS
post_voting_power {'amount': '147684609966928', 'precision': 6, 'nai': '@@000000037'}
next_vesting_withdrawal 1969-12-31 23:59:59+00:00
withdrawn 122859332919074
to_withdraw 122859332919074
withdraw_routes 0
pending_transfers 0
curation_rewards 19327251
posting_rewards 24999078
proxied_vsf_votes [3287206225735, 0, 0, 0]
witnesses_voted_for 29
last_post 2020-12-29 23:20:18+00:00
last_root_post 2020-12-29 22:22:42+00:00
last_post_edit 2020-12-29T23:20:18
last_vote_time 2021-08-04 20:36:42+00:00
post_bandwidth 0
pending_claimed_accounts 904
open_recurrent_transfers 0
is_smt False
delayed_votes []
governance_vote_expiration_ts 2022-10-03T08:57:45
As you can see, @holger80 has (with skills I do not have) preformatted that data.
It's just that reward_hbd_balance 0.000 SBD
makes no sense.
When I use dhive instead, which is much less abstracted and also uses the get_accounts HIVE API call, it returns this set:
code:
<!DOCTYPE html>
<html>
<script src="https://unpkg.com/@hiveio/dhive@latest/dist/dhive.js"></script>
<script>
let myAccount = 'holger80';
let client = new dhive.Client(["https://anyx.io"]);
client.database.getAccounts([myAccount]).then(function(result) {
result.forEach(account => {
console.log(account)
})
})
</script>
</html>
result:
active: {account_auths: Array(0), key_auths: Array(1), weight_threshold: 1}
balance: "0.105 HIVE"
can_vote: true
comment_count: 0
created: "2017-12-29T10:07:45"
curation_rewards: 19327251
delayed_votes: []
delegated_vesting_shares: "0.000000 VESTS"
downvote_manabar: {current_mana: "36921736198976", last_update_time: 1628151795}
governance_vote_expiration_ts: "2022-10-03T08:57:45"
guest_bloggers: []
hbd_balance: "0.114 HBD"
hbd_last_interest_payment: "2021-06-07T08:42:12"
hbd_seconds: "73555602"
hbd_seconds_last_update: "2021-06-28T08:32:06"
id: 538086
json_metadata: "{\"profile\":{\"name\":\"Holger\",\"about\":\"beem Developer, Steem Witness, beempy.com, steemrewarding.com\",\"website\":\"
last_account_recovery: "1970-01-01T00:00:00"
last_account_update: "2020-12-28T22:09:06"
last_owner_update: "1970-01-01T00:00:00"
last_post: "2020-12-29T23:20:18"
last_root_post: "2020-12-29T22:22:42"
last_vote_time: "2021-08-04T20:36:42"
lifetime_vote_count: 0
market_history: []
memo_key: "STM6MQBLaX9Q15CK3prXoWK4C6EqtsL7C4rqq1h6BQjxvfk9tuT3N"
mined: false
name: "holger80"
next_vesting_withdrawal: "1969-12-31T23:59:59"
open_recurrent_transfers: 0
other_history: []
owner: {account_auths: Array(0), key_auths: Array(1), weight_threshold: 1}
pending_claimed_accounts: 904
pending_transfers: 0
post_bandwidth: 0
post_count: 1525
post_history: []
post_voting_power: "147686944.795905 VESTS"
posting: {account_auths: Array(10), key_auths: Array(1), weight_threshold: 1}
posting_json_metadata: "{\"profile\":{\"name\":\"Holger\",\"about\":\"beem Developer, Hive Witness, beempy.com, rewarding.app\",\"website\":\"
posting_rewards: 24999078
proxied_vsf_votes: (4) ["3287206225735", 0, 0, 0]
proxy: ""
received_vesting_shares: "0.000000 VESTS"
recovery_account: "recovery.account"
reputation: "358857509568825"
reset_account: "null"
reward_hbd_balance: "0.000 HBD"
reward_hive_balance: "0.000 HIVE"
reward_vesting_balance: "328436.791168 VESTS"
reward_vesting_hive: "175.112 HIVE"
savings_balance: "0.000 HIVE"
savings_hbd_balance: "0.000 HBD"
savings_hbd_last_interest_payment: "1970-01-01T00:00:00"
savings_hbd_seconds: "0"
savings_hbd_seconds_last_update: "1970-01-01T00:00:00"
savings_withdraw_requests: 0
tags_usage: []
to_withdraw: "122859332919074"
transfer_history: []
vesting_balance: "0.000 HIVE"
vesting_shares: "147686944.795905 VESTS"
vesting_withdraw_rate: "0.000000 VESTS"
vote_history: []
voting_manabar: {current_mana: "147686944795905", last_update_time: 1628151795}
voting_power: 9019
withdraw_routes: 0
withdrawn: "122859332919074"
witness_votes: (29) ["abit", "actifit", "aggroed", "anyx", "arcange", "blocktrades", "bobinson", "cervantes", "deathwing", "dragosroua", "emrebeyler", "engrave", "fbslo", "followbtcnews", "gtg", "guiltyparties", "holger80", "ocd-witness", "quochuy", "qurator", "roelandp", "roomservice", "someguy123", "steempeak", "stem.witness", "techcoderx", "themarkymark", "therealwolf", "timcliff"]
witnesses_voted_for: 29
[[Prototype]]: Object
reward_hbd_balance: "0.000 HBD"
<- seems right.
I presume, this is just the raw data which the underlying API call returns.
No special beem magic (which sometimes can be a blessing) and it just works and returns the real values.
I did not want to be lazy and just complain, so I tried fixing beem myself.
It should be easy to somewhere find holger's type- definitions...
...but I could simply not find it anywhere.
Again: I am not knocking beem.
It is so helpful.
But under the hood it is too complicated for me.
I can not seem to find the module, where these type formats are defined, because the whole thing is in different modules and hence all over the place.
The annoying part is: If it wasn't for holger's (over)engineering, the bug would not even exist.
The raw call would work just fine.
Holger does not reply to my dm's on Discord, which is fine.
I am grateful enough that he made beem in the first place.
I only have to string-manipulate the data and replace 'SBD' with 'HBD' and it works again.
...I just run into these problems all the time...
hive-python
I could use hive-python by @pharesim, instead:
https://gitlab.syncad.com/hive/hive-python
Looks ok, so I click on the documentation, which redirects me here:
https://hive.readthedocs.io/en/latest/
That is not even the right documentation, ffs.
The first click I make redirects me to the wrong documentation!
I told pharesim about this months ago.
It is still not fixed.
I am not touching hive-python, as it is not being maintained at all and was never finished in the first place.
I don't know who will read this post and I don't know what to do next.
For me, the best solution would be a low level python library without all the beem magic.
beem lite?
All the bugs I have run into in the last years taught me so much, that I would for any real project try to write my own purpose-build Python library.
At this point, it is easier to construct the calls myself and deal with the raw data, rather than fixing beem, or hive-python.
Maybe, I should restart my witness and make that my thing: building beem-lite, a library that just works; If I wrote a proposal, it would never go through. Sad.
Again: holger's beem is the best library and I learned so much from analyzing and trying to bugfix it- but it reached a point where it is too complicated for a noob like myself.
I doubt that someone, who hasn't looked into it as much as me or is not a programming wizzard like holger, can even use the advantages of beem.
Not sure what to do, just wanted to express my troubles on-chain.