How to reply to a post using beem

in #steem8 years ago (edited)

It is possible to write comments with the following script:

#!/usr/bin/python
from beem import Steem
from beem.comment import Comment
import getpass


if __name__ == "__main__":
    wif = getpass.getpass(prompt='Enter your posting key.')
    stm = Steem(node="https://api.steem.house", keys=[wif])
    author = "holger80"
    authorperm = "@emrebeyler/how-to-create-a-post-with-the-current-state"
    with open('reply_body.md') as f:
        body = f.read()    
    c = Comment(authorperm, steem_instance=stm)
    c.reply(body, author=author)

steps:

  • install beem (pip install beem -U)
  • store script as reply_post.py
  • change authorperm and author in the script
  • write your reply and store it as reply_body.md
  • Run the script with python reply_body
Sort:  

Thanks for this quick update with the straightforward piece of code. The docs are quite easy to go through and beem has been friendly since day one but seeing a quick solution is much appreciated.

The reward of this comment goes 100 % to the author holger80. This is done by setting the beneficiaries of this comment to 100 %.


Send 0.001 SBD/STEEM to @rewarding with a paid-out post link and a comment with 100% beneficaries will be created. Wait 15 min. and upvote (mind the payout treshold of 0.02).


Hi @idikuci, the comment can be upvoted now.

This post has been upvoted for free by @microbot with 5%!
Get better upvotes by bidding on me.
More profits? 100% Payout! Delegate some SteemPower to @microbot: 1 SP, 5 SP, 10 SP, custom amount
You like to bet and win 20x your bid? Have a look at @gtw and this description!

Thank you.

BTW: What is the difference between beem and steempy(steem-python)?

steempy sucks!

well you better compare beempy/steempy and beem/steem. You definitely should use beem/beempy

Thanks, it works!

Thx for your awesome work!

I was trying to follow your code. but not working. Can you see if anything is missing:

#!/usr/bin/python
from beem import Steem
from beem.comment import Comment


stm = Steem(node="https://api.steem.house",keys=["MY_POSTING_KEY"])
author = "unnikuttan"
authorperm = "@dexterdev/iran-bites-me-again-it-seems-contest-1-steem-gift-inside"
with open('reply_body.md') as f:
    body = f.read()
c = Comment(authorperm, steem_instance=stm)
c.reply(body, author=author)

I have also prepared this file: reply_body.md

I am getting error like this:

@holger80 Can you help me? Thank you.