commit.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:steem-python 作者: steemit 项目源码 文件源码
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")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号