def vote(self,
identifier,
weight,
account=None):
""" Vote for a post
:param str identifier: Identifier for the post to upvote Takes
the form ``@author/permlink``
:param float weight: Voting weight. Range: -100.0 - +100.0. May
not be 0.0
:param str account: Voter to use for voting. (Optional)
If ``voter`` is not defines, the ``default_account`` will be taken or
a ValueError will be raised
.. code-block:: python
steempy set default_account <account>
"""
if not account:
account = configStorage.get("default_account")
if not account:
raise ValueError("You need to provide a voter account")
post_author, post_permlink = resolve_identifier(identifier)
op = operations.Vote(
**{"voter": account,
"author": post_author,
"permlink": post_permlink,
"weight": int(weight * STEEMIT_1_PERCENT)}
)
return self.finalizeOp(op, account, "posting")
评论列表
文章目录