beem.comment

class beem.comment.Comment(authorperm, use_tags_api=True, full=True, lazy=False, steem_instance=None)

Bases: beem.blockchainobject.BlockchainObject

Read data about a Comment/Post in the chain

Parameters:
  • authorperm (str) – identifier to post/comment in the form of @author/permlink
  • use_tags_api (boolean) – when set to False, list_comments from the database_api is used
  • steem_instance (Steem) – beem.steem.Steem instance to use when accessing a RPC

>>> from beem.comment import Comment
>>> from beem.account import Account
>>> from beem import Steem
>>> stm = Steem()
>>> acc = Account("gtg", steem_instance=stm)
>>> authorperm = acc.get_blog(limit=1)[0]["authorperm"]
>>> c = Comment(authorperm)
>>> postdate = c["created"]
>>> postdate_str = c.json()["created"]
author
authorperm
body
category
curation_penalty_compensation_SBD()

Returns The required post payout amount after 15 minutes which will compentsate the curation penalty, if voting earlier than 15 minutes

delete(account=None, identifier=None)

Delete an existing post/comment

Parameters:
  • account (str) – (optional) Account to use for deletion. If account is not defined, the default_account will be taken or a ValueError will be raised.
  • identifier (str) – (optional) Identifier for the post to delete. Takes the form @author/permlink. By default the current post will be used.

Note

A post/comment can only be deleted as long as it has no replies and no positive rshares on it.

depth
downvote(weight=100, voter=None)

Downvote the post

Parameters:
  • weight (float) – (optional) Weight for posting (-100.0 - +100.0) defaults to -100.0
  • voter (str) – (optional) Voting account
edit(body, meta=None, replace=False)

Edit an existing post

Parameters:
  • body (str) – Body of the reply
  • meta (json) – JSON meta object that can be attached to the post. (optional)
  • replace (bool) – Instead of calculating a diff, replace the post entirely (defaults to False)
estimate_curation_SBD(vote_value_SBD, estimated_value_SBD=None)

Estimates curation reward

Parameters:
  • vote_value_SBD (float) – The vote value in SBD for which the curation should be calculated
  • estimated_value_SBD (float) – When set, this value is used for calculate the curation. When not set, the current post value is used.
get_all_replies(parent=None)

Returns all content replies

get_author_rewards()

Returns the author rewards.

Example:

{
    'pending_rewards': True,
    'payout_SP': 0.912 STEEM,
    'payout_SBD': 3.583 SBD,
    'total_payout_SBD': 7.166 SBD
}
get_beneficiaries_pct()

Returns the sum of all post beneficiaries in percentage

get_curation_penalty(vote_time=None)

If post is less than 5 minutes old, it will incur a curation reward penalty.

Parameters:vote_time (datetime) – A vote time can be given and the curation penalty is calculated regarding the given time (default is None) When set to None, the current date is used.
Returns:Float number between 0 and 1 (0.0 -> no penalty, 1.0 -> 100 % curation penalty)
Return type:float
get_curation_rewards(pending_payout_SBD=False, pending_payout_value=None)

Returns the curation rewards. The split between creator/curator is currently 50%/50%.

Parameters:
  • pending_payout_SBD (bool) – If True, the rewards are returned in SBD and not in STEEM (default is False)
  • pending_payout_value (float, str) – When not None this value instead of the current value is used for calculating the rewards

pending_rewards is True when the post is younger than 7 days. unclaimed_rewards is the amount of curation_rewards that goes to the author (self-vote or votes within the first 30 minutes). active_votes contains all voter with their curation reward.

Example:

{
    'pending_rewards': True, 'unclaimed_rewards': 0.245 STEEM,
    'active_votes': {
        'leprechaun': 0.006 STEEM, 'timcliff': 0.186 STEEM,
        'st3llar': 0.000 STEEM, 'crokkon': 0.015 STEEM, 'feedyourminnows': 0.003 STEEM,
        'isnochys': 0.003 STEEM, 'loshcat': 0.001 STEEM, 'greenorange': 0.000 STEEM,
        'qustodian': 0.123 STEEM, 'jpphotography': 0.002 STEEM, 'thinkingmind': 0.001 STEEM,
        'oups': 0.006 STEEM, 'mattockfs': 0.001 STEEM, 'holger80': 0.003 STEEM, 'michaelizer': 0.004 STEEM,
        'flugschwein': 0.010 STEEM, 'ulisessabeque': 0.000 STEEM, 'hakancelik': 0.002 STEEM, 'sbi2': 0.008 STEEM,
        'zcool': 0.000 STEEM, 'steemhq': 0.002 STEEM, 'rowdiya': 0.000 STEEM, 'qurator-tier-1-2': 0.012 STEEM
    }
}
get_parent(children=None)

Returns the parent post with depth == 0

get_reblogged_by(identifier=None)

Shows in which blogs this post appears

get_replies(raw_data=False, identifier=None)

Returns content replies

Parameters:raw_data (bool) – When set to False, the replies will be returned as Comment class objects
get_rewards()

Returns the total_payout, author_payout and the curator payout in SBD. When the payout is still pending, the estimated payout is given out.

Note

Potential beneficiary rewards were already deducted from the author_payout and the total_payout

Example::

{
    'total_payout': 9.956 SBD,
    'author_payout': 7.166 SBD,
    'curator_payout': 2.790 SBD
}
get_vote_with_curation(voter=None, raw_data=False, pending_payout_value=None)

Returns vote for voter. Returns None, if the voter cannot be found in active_votes.

Parameters:
  • voter (str) – Voter for which the vote should be returned
  • raw_data (bool) – If True, the raw data are returned
  • pending_payout_SBD (float, str) – When not None this value instead of the current value is used for calculating the rewards
get_votes(raw_data=False)

Returns all votes as ActiveVotes object

id
is_comment()

Returns True if post is a comment

is_main_post()

Returns True if main post, and False if this is a comment (reply).

is_pending()

Returns if the payout is pending (the post/comment is younger than 7 days)

json()
json_metadata
parent_author
refresh()
reply(body, title='', author='', meta=None)

Reply to an existing post

Parameters:
  • body (str) – Body of the reply
  • title (str) – Title of the reply post
  • author (str) – Author of reply (optional) if not provided default_user will be used, if present, else a ValueError will be raised.
  • meta (json) – JSON meta object that can be attached to the post. (optional)
resteem(identifier=None, account=None)

Resteem a post

Parameters:
  • identifier (str) – post identifier (@<account>/<permlink>)
  • account (str) – (optional) the account to allow access to (defaults to default_account)
reward

Return the estimated total SBD reward.

time_elapsed()

Returns a timedelta on how old the post is.

title
type_id = 8
upvote(weight=100, voter=None)

Upvote the post

Parameters:
  • weight (float) – (optional) Weight for posting (-100.0 - +100.0) defaults to +100.0
  • voter (str) – (optional) Voting account
vote(weight, account=None, identifier=None, **kwargs)

Vote for a post

Parameters:
  • weight (float) – Voting weight. Range: -100.0 - +100.0.
  • account (str) – (optional) Account to use for voting. If account is not defined, the default_account will be used or a ValueError will be raised
  • identifier (str) – Identifier for the post to vote. Takes the form @author/permlink.
class beem.comment.RankedPosts(sort='trending', tag='', observer='', lazy=False, full=True, steem_instance=None)

Bases: list

Obtain a list of ranked posts

Parameters:
  • account (str) – Account name
  • steem_instance (Steem) – Steem() instance to use when accesing a RPC
class beem.comment.RecentByPath(path='trending', category=None, lazy=False, full=True, steem_instance=None)

Bases: list

Obtain a list of posts recent by path

Parameters:
  • account (str) – Account name
  • steem_instance (Steem) – Steem() instance to use when accesing a RPC
class beem.comment.RecentReplies(author, skip_own=True, lazy=False, full=True, steem_instance=None)

Bases: list

Obtain a list of recent replies

Parameters:
  • author (str) – author
  • skip_own (bool) – (optional) Skip replies of the author to him/herself. Default: True
  • steem_instance (Steem) – Steem() instance to use when accesing a RPC