beem.comment module

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

Bases: beem.blockchainobject.BlockchainObject

Read data about a Comment/Post in the chain

Parameters:
  • authorperm (str) – perm link to post/comment
  • steem_instance (steem) – Steem() instance to use when accesing a RPC
author
authorperm
body
category
comment_options(options, identifier=None, account=None)

Set the comment options :param str identifier: Post identifier :param dict options: The options to define. :param str account: (optional) the account to allow access

to (defaults to default_account)
For the options, you have these defaults:::
{
“author”: “”, “permlink”: “”, “max_accepted_payout”: “1000000.000 SBD”, “percent_steem_dollars”: 10000, “allow_votes”: True, “allow_curation_rewards”: True,

}

downvote(weight=-100, voter=None)

Downvote the post :param float weight: (optional) Weight for posting (-100.0 - +100.0) defaults to -100.0 :param str voter: (optional) Voting account

edit(body, meta=None, replace=False)

Edit an existing post :param str body: Body of the reply :param json meta: JSON meta object that can be attached to the

post. (optional)
Parameters:replace (bool) – Instead of calculating a diff, replace the post entirely (defaults to False)
id
is_comment()

Retuns True if post is a comment

is_main_post()

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

json()
json_metadata
parent_author
post(title=None, body=None, author=None, permlink=None, reply_identifier=None, json_metadata=None, comment_options=None, community=None, tags=None, beneficiaries=None, self_vote=False)

Create a new post. If this post is intended as a reply/comment, reply_identifier needs to be set with the identifier of the parent post/comment (eg. @author/permlink). Optionally you can also set json_metadata, comment_options and upvote the newly created post as an author. Setting category, tags or community will override the values provided in json_metadata and/or comment_options where appropriate. Args: title (str): Title of the post body (str): Body of the post/comment author (str): Account are you posting from permlink (str): Manually set the permlink (defaults to None).

If left empty, it will be derived from title automatically.
reply_identifier (str): Identifier of the parent post/comment (only
if this post is a reply/comment).
json_metadata (str, dict): JSON meta object that can be attached to
the post.
comment_options (str, dict): JSON options object that can be
attached to the post.
Example::
comment_options = {

‘max_accepted_payout’: ‘1000000.000 SBD’, ‘percent_steem_dollars’: 10000, ‘allow_votes’: True, ‘allow_curation_rewards’: True, ‘extensions’: [[0, {

‘beneficiaries’: [
{‘account’: ‘account1’, ‘weight’: 5000}, {‘account’: ‘account2’, ‘weight’: 5000},

]}

]]

}

community (str): (Optional) Name of the community we are posting
into. This will also override the community specified in json_metadata.
tags (str, list): (Optional) A list of tags (5 max) to go with the
post. This will also override the tags specified in json_metadata. The first tag will be used as a ‘category’. If provided as a string, it should be space separated.
beneficiaries (list of dicts): (Optional) A list of beneficiaries
for posting reward distribution. This argument overrides beneficiaries as specified in comment_options.

For example, if we would like to split rewards between account1 and account2:

beneficiaries = [
    {'account': 'account1', 'weight': 5000},
    {'account': 'account2', 'weight': 5000}
]
self_vote (bool): (Optional) Upvote the post as author, right after
posting.
refresh()
reply(body, title='', author='', meta=None)

Reply to an existing post :param str body: Body of the reply :param str title: Title of the reply post :param str author: Author of reply (optional) if not provided

default_user will be used, if present, else a ValueError will be raised.
Parameters:meta (json) – JSON meta object that can be attached to the post. (optional)
resteem(identifier=None, account=None)

Resteem a post :param str identifier: post identifier (@<account>/<permlink>) :param str account: (optional) the account to allow access

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

Upvote the post :param float weight: (optional) Weight for posting (-100.0 - +100.0) defaults to +100.0 :param str voter: (optional) Voting account

vote(weight, account=None, identifier=None, **kwargs)

Vote for a post :param str identifier: Identifier for the post to upvote Takes

the form @author/permlink
Parameters:
  • weight (float) – Voting weight. Range: -100.0 - +100.0. May not be 0.0
  • account (str) – Voter to use for voting. (Optional)

If voter is not defines, the default_account will be taken or a ValueError will be raised

class beem.comment.RecentByPath(path='promoted', category=None, steem_instance=None)

Bases: list

Obtain a list of votes for an account

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

Bases: list

Obtain a list of recent replies

Parameters:
  • author (str) – author
  • steem_instance (steem) – Steem() instance to use when accesing a RPC