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

avatar
(Edited)

Repository

https://github.com/holgern/beem


beem-logo\n

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
print(Block(33898183)["timestamp"])
print(Block(33898184)["timestamp"])

returns

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))
print(block_num)

returns now

33898184

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

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

and

Usage: beempy downvote [OPTIONS] POST

  Downvote a post/comment

  POST is @author/permlink

Options:
  -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()
nodes.get_nodes()

returns now

['https://steemd.minnowsupportproject.org',
 'https://rpc.usesteem.com',
 'https://anyx.io',
 'https://steemd.privex.io',
 'http://anyx.io',
 'https://appbasetest.timcliff.com',
 'https://api.steem.house']

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

Commits

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

https://github.com/holgern



12 comments
avatar

Everything is okay! 👌


You received an automatic upvote, because I believe in you and I love what you create! 😉

A huge hug from @amico! 🤗

😍 I love promoting @steembasicincome, even with #sbi-skip! 😜


If you dislike this automatic message, please let me know: thanks! 🙏

avatar

Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!

avatar

Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 7.500 which ranks you at #54 across all Steem accounts.
Your rank has improved 2 places in the last three days (old rank 56).

In our last Algorithmic Curation Round, consisting of 171 contributions, your post is ranked at #3. Congratulations!

Evaluation of your UA score:
  • Your follower network is great!
  • The readers appreciate your great work!
  • Great user engagement! You rock!

Feel free to join our @steem-ua Discord server

avatar

Hi, @holger80!

You just got a 3.93% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

avatar

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.

[utopian-moderator]

0
0
0.000
avatar

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

0
0
0.000