update for beem - post, reply and beneficiaries commands added to beempy

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 504 unit tests and a coverage of 72 %. The current version is 0.20.10.
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

New Features

beempy beneficiaries

beempy beneficiaries authorperm account1:10%,account2:20%,...

Adds beneficiaries to post/comment authorperm. This is only sucecssfully when the post/comment was not upvoted yet. More information about this can be found in this test post.

beempy post

usage: beempy post [OPTIONS] BODY
  broadcast a post/comment

Options:
  -a, --account TEXT        Account are you posting from
  -t, --title TEXT          Title of the post
  -p, --permlink TEXT       Manually set the permlink (optional)
  --tags TEXT               A komma separated list of tags to go with the
                            post.
  --reply_identifier TEXT   Identifier of the parent post/comment, when set a
                            comment is broadcasted
  --community TEXT          Name of the community (optional)
  -b, --beneficiaries TEXT  Post beneficiaries (komma separated, e.g.
                            a:10%,b:20%)
  --no-parse-body           Disable parsing of links, tags and images
  --help                    Show this message and exit.

BODY is the link to a text file containing the body text of the post/comment. The post command can also parse a yaml header.

typora can be used to create a markdown with yaml header.
image.png

Broadcasting was done by:

beempy post beempy-post-test.md

The broadcasted test post can be found here,
The yaml header of the example:

---
title: beempy test post
tags: test, beempy
author: beembot
beneficiaries: holger80:10%
---

The following keywords can be used:

  • title
  • author
  • permlink
  • reply_identifier
  • community
  • parse_body
  • beneficiaries

Parameter set as option overwrite parameter defined in the YAML part. When e.g. --title a is set and in the file title: b is written, the resulting title is then a.

Editing of posts is possible.
Just edit the markdown file and broadcast the post again. The beneficiaries must be removed when the post should be modified.

beempy reply

Usage: beempy reply [OPTIONS] AUTHORPERM BODY

  replies to a comment

Options:
  -a, --account TEXT  Account are you posting from
  -t, --title TEXT    Title of the post
  --help              Show this message and exit.

The reply can be used to broadcast short comments.

New GetWitnesses class

from beem.witness import GetWitnesses
w_list = GetWitnesses(["gtg", "timcliff"])
print(w_list [0])
print(w_list [0])

results in

<Witness gtg>
<Witness timcliff>

The class can be used to fastly fetch a list of witnesses at once.

RC costs adapted to the changes of 0.20.6

With 0.20.6 some parameter for RC costs calculation were changed. The changes are adapted in the RC class. Most important change is that resource_execution_time is included in the RC calculation.

update_account_keys function added

from beem import Steem
from beem.account import Account
stm = Steem(keys=["5xx"]) # owner key
account = Account("name", steem_instance=stm)
account.update_account_keys("new_password")

new_password is the new master password and the posting_key, active_key, owner_key and memo_key are calculated from the master password.
This is done by:

        for role in ['owner', 'active', 'posting', 'memo']:
            pk = PasswordKey(account['name'], new_password, role=role)
            key_auths[role] = format(pk.get_public_key(), self.steem.prefix) 

Commit history

Fix typo and adapt changelog

Add beempy post and beempy reply

Add beneficiaries command to beempy

  • commit 3145ffd
  • New anyx.io node added to nodelist
  • GetWitnesses fixed

Fix issue #115 - Signing operations from Python2 throw beem.exceptios.InvalidWifError

Fix for issue #109: Add missing get_witnesses

Several improvements and prepare next release

  • commit 5b269ab9
    Account
  • update_account_keys added for changing account keys
  • comment fixed for chains without SBD
    RC
  • RC changes from 0.20.6 included
    Witness
  • Fixed for chains without SBD symbol
    Operations
  • Claim_reward_balance fixed for chains without SBD symbol

Chains

  • VIT fixed

Github account

https://github.com/holgern

Sort:  

Thank you for your contribution. I'm glad that BEEM is under active development regarding bug-fixes and new features.

Regarding the method beneficials, you implemented in cli.py, could it be better if you extract the logics and put it somewhere not in the cli.py because it looks to me that the cli.py is the command line utility that should only handle the command line options etc - all other logics could be moved to other modules for better code resusablilty and code testing.

And also, beneificals and etc contains quite a lot of code with no comments.

How do you make sure these functions beneificals, GetWitnessesare not broken? e.g. I haven't seen unit tests covering these two newly-added methods.

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]

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

Glad to see someone continue my work on pysteem/piston-lib and piston-cli. Looking forward to using it again. Much love for command line tools :D

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.

Hi, @holger80!

You just got a 1.82% 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.

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.223 which ranks you at #71 across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 260 contributions, your post is ranked at #154.

Evaluation of your UA score:
  • Your follower network is great!
  • The readers appreciate your great work!
  • Try to work on user engagement: the more people that interact with you via the comments, the higher your UA score!

Feel free to join our @steem-ua Discord server

pyyaml is currently missing as dep.

pip install pyyaml

I will fix this in the next release.

Posted using Partiko Android

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 or Steeditor).

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

Vote for Utopian Witness!