update for beem - several improvements and bug fixes

in #utopian-io6 years ago (edited)

Repository

https://github.com/holgern/beem


beem-logo.png

beem is a python library for steem. beem has now 536 unit tests and a coverage of 74 %. The current version is 0.19.49.
I created a discord channel for answering a question or discussing beem: https://discord.gg/4HM592V


Bug Fixes

Discussions.get_discussions("blog", ...) returns the same two comments over and over

The bug was fixed in commit 0416477.
The limitation of get_discussions_by_blog is that only 100 entries can be fetched at once. More entries can be obtained by setting start_author and start_permlink the last obtained post.
This post is then obtained twice. Once in the previous call and once in the next call. In beem, a logic was implemented to skip this doubled post.

The observed error could be observed in some special cases. The bug was fixed by implementing a better logic:

if query_count != 0 and rpc_query_count == 0 and (d["author"] == start_author and d["permlink"] == start_permlink):
    double_result = True
    if len(dd) == 1:
        found_more_than_start_entry = False
start_author = d["author"]
start_permlink = d["permlink"]

get_all_replies and get_parent were added to beem.comment.Comment

Two important functions for which no RPC-API call exists were added. get_all_replies returns all replies from a comment. All comments are returned in list. depth, parent_permlink and parent_author are included into each comment. Using these three values, the complete reply structure can be reconstructed (Building a reply tree is planned for one of the next updates).

from beem.comment import Comment
byteball_post = Comment("@punqtured/official-byteball-airdrop-to-steemians")
all_replies = byteball_post.get_all_replies()
len(all_replies)
2481

Let's take a look on the 1000th reply:
carbon (4).png

get_parent() can now be used to find the parent post:

reply = Comment("@samhamou/re-tincho-re-gaurav9971-re-punqtured-official-byteball-airdrop-to-steemians-20180712t225124402z")
parent = reply.get_parent()
parent.authorperm
'@punqtured/official-byteball-airdrop-to-steemians'

Reconstruct vote power since account creation

With the newest improvements (commit 305491f) for beem.snapshot.AccountSnapshot it is now possible to reconstruct the vote power since account creation. Only weight and timestamp of all outgoing votes is used to reconstruct the vote power:

carbon.png

voting-power-holger80.png
Last reconstructed vote power for my account is 93.64. The current vote power of my account is

from beem.account import Account
acc = Account("holger80")
acc.get_voting_power(False)
93.65

The difference is only 0.01 %.

Reconstruct account reputation over time

Reconstruction of account reputation was added in
commit fa2675b
The account reputation is calculated from all incoming votes using the vote timestamp, rshares and voter reputation:
carbon (3).png

reputation-holger80.png
The last reconstructed reputation value is:

last reputation 62.581168

whereas my current repution is:

from beem.account import Account
acc = Account("holger80")
acc.get_reputation()
62.604815023975625

The difference between my current and the reconstructed repution is only 0.0236.

Commit history

Prepare next release and fix Amount for condenser broadcast ops (used for appbase right now)

fixes issue #45

  • commit fc85671
  • Fixes issue #45 by checking the timestamp of last_payout instead of net_rshares. With these changes, voting of unvoted posts/comments is possible.
  • Refactoring of Transactionbuilder and adding of _use_condenser_api for defining the use of condenser api on broadcasting when using appbase nodes

Add get_all_replies to comment for fetching all replies

Fix formatToTimestamp for python 2.7

Refactor Amount detection in account, claimreward improved

Several improvements and fixes

CLI
  • upvote and downvote fixed
Snapshot
  • refactoring
  • update_vote and build_vp_arrays added for showing vote power history
Examples
  • account_vp_over_time added

Prepare next release and add next_witness_block_countdown example

add get_parent to comment and fix for beempy reward

Fix issue #51

Fixes replies for Discussions

Fixes Discussions, when only one reply is returned

snapshot improved and unit test fixed

Snapshot
  • update_in_vote added
  • enable_votes changed to enable_in_votes and enable_out_votes
  • build_rep_arrays added
Example
  • account_vp_over_time added
  • account_reputation_by_SP added
Discussion
  • check if parameter exists in discussion_query added

Fix #57 and try to improve error "Client returned invalid format. Expected JSON!" handling

Fix unit tests and improve json export for account

Fix flake8 and improve steemconnect fix for #57


If you like what I'm doing, please consider @holger80 as one of your witnesses (steemconnect).

Sort:  

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

This post has been just added as new item to timeline of beem on Steem Projects.

If you want to be notified about new updates from this project, register on Steem Projects and add beem to your favorite projects.

Hey @holger80
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!