create account

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

View this thread on: hive.blogpeakd.comecency.com
· @holger80 · (edited)
$31.25
update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed
### Repository
https://github.com/holgern/beem<center>
![beem-logo](https://cdn.steemitimages.com/DQmcRrwLPSywSYMierfP6um6mejeMNGjN9Rxw7audJqTDgb/beem-logo)\n</center>
[beem](https://github.com/holgern/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](https://github.com/holgern/beem/pull/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](https://github.com/holgern/beem/pull/192)

## Commits
### Fix float parsing for beempy upvote and downvote
* [commit f42b99a](https://github.com/holgern/beem/commit/f42b99a00471cca72f989c88173712df44d0741d)
### Fix unit tests for changed upvote and downvote in beempy
* [commit 059778d](https://github.com/holgern/beem/commit/059778d7d80692bb8214f7c1e914f0383f0f6bc8)
### * Fix bug for get_estimated_block_num when a block is missing
* [commit a05d81f](https://github.com/holgern/beem/commit/a05d81fa81eaa2d4b70cdce32d4caafef5c6f991)
### Move vote function to steem and fix #193 
* [commit be6461d](https://github.com/holgern/beem/commit/be6461dcf7116e9d6882ca3f19d5a503d1f1fdae)
* 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 
* [commit 1733efd](https://github.com/holgern/beem/commit/1733efd1450c9ce3260f6d78133d5da01e7bd0a0)
* comment.downvote(100) will now downvote with 100 %


## Github account
https://github.com/holgern
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 230 others
properties (23)
authorholger80
permlinkupdate-for-beem-new-vote-function-in-steem-upvote-downvote-fixed-permlink-generation-improved-and-whaleshares-support-fixed
categoryutopian-io
json_metadata"{"tags": ["utopian-io", "development", "beem", "python", "palnet"], "image": ["https://cdn.steemitimages.com/DQmcRrwLPSywSYMierfP6um6mejeMNGjN9Rxw7audJqTDgb/beem-logo"], "links": ["https://github.com/holgern/beem", "https://discord.gg/4HM592V", "https://github.com/holgern/beem/pull/181", "https://github.com/holgern/beem/pull/192", "https://github.com/holgern/beem/commit/f42b99a00471cca72f989c88173712df44d0741d", "https://github.com/holgern/beem/commit/059778d7d80692bb8214f7c1e914f0383f0f6bc8", "https://github.com/holgern/beem/commit/a05d81fa81eaa2d4b70cdce32d4caafef5c6f991", "https://github.com/holgern/beem/commit/be6461dcf7116e9d6882ca3f19d5a503d1f1fdae", "https://github.com/holgern/beem/commit/1733efd1450c9ce3260f6d78133d5da01e7bd0a0", "https://github.com/holgern"], "app": "beempy/0.23.10", "format": "markdown", "canonical_url": "https://hive.blog/utopian-io/@holger80/update-for-beem-new-vote-function-in-steem-upvote-downvote-fixed-permlink-generation-improved-and-whaleshares-support-fixed"}"
created2019-07-12 13:48:39
last_update2020-05-23 14:25:51
depth0
children12
last_payout2019-07-19 13:48:39
cashout_time1969-12-31 23:59:59
total_payout_value24.443 HBD
curator_payout_value6.810 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,672
author_reputation358,857,509,568,825
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,203,661
net_rshares92,027,956,267,234
author_curate_reward""
vote details (294)
@amico ·
___
#### <center> Everything is okay! πŸ‘Œ </center> 
___
You received an automatic upvote, because I believe in you and I love what you create! πŸ˜‰

A huge hug from @amico! πŸ€—

<sup><sup><sup><sup>😍 I love promoting @steembasicincome, even with #sbi-skip! 😜 </sup></sup></sup></sup>
___

<center> If you dislike this automatic message, please let me know: thanks! πŸ™</center> 
properties (22)
authoramico
permlinkre-update-for-beem-new-vote-function-in-steem-upvote-downvote-fixed-permlink-generation-improved-and-whaleshares-support-fixed-20190712t140250z
categoryutopian-io
json_metadata"{"app": "rewarding/0.1.5"}"
created2019-07-12 14:02:54
last_update2019-07-12 14:02:54
depth1
children0
last_payout2019-07-19 14:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length380
author_reputation51,076,240,298,517
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,204,308
net_rshares0
@emrebeyler ·
$3.58
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](https://join.utopian.io/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](https://review.utopian.io/result/3/2-2-3-1-1-1-1-).

---- 
Need help? Chat with us on [Discord](https://discord.gg/uTyJkNm).

[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authoremrebeyler
permlinkpullid
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/3/2-2-3-1-1-1-1-","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2019-07-13 20:42:12
last_update2019-07-13 20:42:12
depth1
children2
last_payout2019-07-20 20:42:12
cashout_time1969-12-31 23:59:59
total_payout_value2.755 HBD
curator_payout_value0.825 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length618
author_reputation448,535,049,068,622
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,257,661
net_rshares10,382,509,415,780
author_curate_reward""
vote details (22)
@holger80 ·
$0.15
Thanks for the review.
I'm planing a major update when the next hardfork is there :).
πŸ‘  , , ,
properties (23)
authorholger80
permlinkpulnr0
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2019-07-13 21:30:42
last_update2019-07-13 21:30:42
depth2
children0
last_payout2019-07-20 21:30:42
cashout_time1969-12-31 23:59:59
total_payout_value0.111 HBD
curator_payout_value0.035 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length85
author_reputation358,857,509,568,825
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,259,025
net_rshares422,201,835,066
author_curate_reward""
vote details (4)
@utopian-io ·
Thank you for your review, @emrebeyler! Keep up the good work!
properties (22)
authorutopian-io
permlinkre-pullid-20190715t233400z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-07-15 23:34:03
last_update2019-07-15 23:34:03
depth2
children0
last_payout2019-07-22 23:34:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length62
author_reputation152,955,367,999,756
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,344,543
net_rshares0
@partiko ·
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!
properties (22)
authorpartiko
permlinkre-update-for-beem-new-vote-function-in-steem-upvote-downvote-fixed-permlink-generation-improved-and-whaleshares-support-fixed-20190712t143033
categoryutopian-io
json_metadata"{"app": "partiko"}"
created2019-07-12 14:30:36
last_update2019-07-12 14:30:36
depth1
children0
last_payout2019-07-19 14:30:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length213
author_reputation39,207,160,334,751
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,205,694
net_rshares0
@schlafhacking ·
dieses update mΓΆchte @backinblackdevil bestimmt gleich installieren ;-)
properties (22)
authorschlafhacking
permlinkpujobv
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["backinblackdevil"],"app":"steemit/0.1"}
created2019-07-12 19:48:00
last_update2019-07-12 19:48:00
depth1
children0
last_payout2019-07-19 19:48:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length71
author_reputation15,067,517,752,330
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,217,826
net_rshares0
@steem-plus ·
SteemPlus upvote
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](https://steemit.com/@steem-plus) to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.
properties (22)
authorsteem-plus
permlinkupdate-for-beem-new-vote-function-in-steem-upvote-downvote-fixed-permlink-generation-improved-and-whaleshares-support-fixed---vote-steemplus
categoryutopian-io
json_metadata{}
created2019-07-13 00:12:51
last_update2019-07-13 00:12:51
depth1
children0
last_payout2019-07-20 00:12:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length435
author_reputation247,952,188,232,400
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,224,514
net_rshares0
@steem-ua ·
#### 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](https://discord.gg/KpBNYGz)**
properties (22)
authorsteem-ua
permlinkre-update-for-beem-new-vote-function-in-steem-upvote-downvote-fixed-permlink-generation-improved-and-whaleshares-support-fixed-20190712t211924z
categoryutopian-io
json_metadata"{"app": "beem/0.20.19"}"
created2019-07-12 21:19:24
last_update2019-07-12 21:19:24
depth1
children0
last_payout2019-07-19 21:19:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length644
author_reputation23,214,230,978,060
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,220,256
net_rshares0
@steemitboard ·
<center>[![](https://steemitimages.com/175x175/http://steemitboard.com/@holger80/level.png?201907150845)](https://steemitboard.com/@holger80)
**Congratulations @holger80**!
You raised your level and are now an **Orca**!</center>

###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-holger80-20190715t093733000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-07-15 09:37:33
last_update2019-07-15 09:37:33
depth1
children0
last_payout2019-07-22 09:37:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length407
author_reputation38,975,615,169,260
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,318,102
net_rshares0
@steemprojects ·
This post has been just added as new item to _[timeline of beem on Steem Projects](https://steemprojects.com/projects/p/beem/?utm_source=comment_timeline&utm_medium=steem&utm_campaign=new_event&utm_content=c1)_.

If you want to be notified about new updates from this project, register on Steem Projects and add beem to your favorite projects.
properties (22)
authorsteemprojects
permlinkre-update-for-beem-new-vote-function-in-steem-upvote-downvote-fixed-permlink-generation-improved-and-whaleshares-support-fixed-20190712t142301
categoryutopian-io
json_metadata""
created2019-07-12 14:23:03
last_update2019-07-12 14:23:03
depth1
children0
last_payout2019-07-19 14:23:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length345
author_reputation29,054,729,340
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,205,348
net_rshares0
@teenagecrypto ·
Do you have any code for a beem bid bot
properties (22)
authorteenagecrypto
permlinkpunfnx
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2019-07-14 20:31:09
last_update2019-07-14 20:31:09
depth1
children0
last_payout2019-07-21 20:31:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length39
author_reputation25,380,001,614,578
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,297,822
net_rshares0
@utopian-io ·
Hey, @holger80!

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

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

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

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-update-for-beem-new-vote-function-in-steem-upvote-downvote-fixed-permlink-generation-improved-and-whaleshares-support-fixed-20190714t020642z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-07-14 02:06:45
last_update2019-07-14 02:06:45
depth1
children0
last_payout2019-07-21 02:06:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length590
author_reputation152,955,367,999,756
root_title"update for beem - new vote function in Steem(), upvote/downvote fixed, permlink generation improved and whaleshares support fixed"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id88,266,027
net_rshares0