update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed

in utopian-io •  last year  (edited)




beem is a python library for steem. beem has now 495 unit tests and a coverage of 70 %. The current version is 0.20.22.
I created a discord channel for answering a question or discussing beem: https://discord.gg/4HM592V
The newest beem version can be installed by:

pip install -U beem

or when using conda:

conda install beem

beem can be updated by:

conda update beem

Bug fixes

get_estimated_block_num() returns results, when a block is missing

from beem.blockchain import Blockchain
from beem.block import Block
from datetime import datetime


datetime.datetime(2019, 6, 18, 5, 8, 24, tzinfo=<UTC>)
datetime.datetime(2019, 6, 18, 5, 8, 33, tzinfo=<UTC>)

The time difference between block 33898184 and 33898183 is 9 seconds, which leads for timestamps between them to an infinite loop in get_estimated_block_num

This is fixed by checking of the second_last_block_time_diff_seconds == block_time_diff.total_seconds() in the while loop and returning the current block_num when true. This prevents infinite loops in which block_num jumps bewteen two values.

blockchain = Blockchain()
block_num = blockchain.get_estimated_block_num(datetime(2019, 6, 18, 5 ,8, 27))

returns now


New Features

Move the vote function to the Steem class

It is now possible to vote with the Steem class:

from beem import Steem
stm = Steem(keys=["xxx"])
stm.vote(100, "@author/permlink", account="voter1")

This allows it to vote without loading the content with Comment. A wrapper function was added to Comment, so that is still possible to use

from beem.comment import Comment
c = Comment("@author/permlink")
c.vote(100, account="voter1")

Upvote and Downvote accepts only positive weights now

Usage: beempy upvote [OPTIONS] POST

  Upvote a post/comment

  POST is @author/permlink

  -w, --weight TEXT   Vote weight (from 0.1 to 100.0)
  -a, --account TEXT  Voter account name
  --help              Show this message and exit.


Usage: beempy downvote [OPTIONS] POST

  Downvote a post/comment

  POST is @author/permlink

  -a, --account TEXT    Voter account name
  -w, --weight INTEGER  Downvote weight (from 0.1 to 100.0)
  --help                Show this message and exit.

So downvote accepts only positive numbers now. So it is not possible anymore to downvote with upvote() and to upvote with downvote().

Update nodelist

The list of working node was update in Nodelist

from beem.nodelist import NodeList
nodes = NodeList()

returns now


Accepted PR

improve permlink derivation #181 by crokkon

PR #181

  • append timestamp also to root post permlinks to avoid overwriting existing
    posts with the same title (fixes #179)
  • avoid root permlinks to exceed the maximum length
  • refactoring reply permlinks

fixes compatibility issues with WhaleShares HF2 / v2.5 #192 by alexpmorris

PR #192


Fix float parsing for beempy upvote and downvote

Fix unit tests for changed upvote and downvote in beempy

* Fix bug for get_estimated_block_num when a block is missing

Move vote function to steem and fix #193

  • commit be6461d
  • The vote operation is now available at the steem object
  • A vote wrapper function with the old syntax is available at comment
  • The upvote and downvote at the cli (beempy) has now one argument, the weight must specified by --weight or -w

Fix issue #195 and update nodelist

Github account


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Interesting find with the 9 seconds interval between consecutive blocks. This changeset generally includes minor updates, but good to see Beem is maintained well.

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? Chat with us on Discord.


Thanks for the review.
I'm planing a major update when the next hardfork is there :).

Thank you for your review, @emrebeyler! Keep up the good work!

dieses update möchte @backinblackdevil bestimmt gleich installieren ;-)

Do you have any code for a beem bid bot

Congratulations @holger80!
You raised your level and are now an Orca!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!