Been struggling with some code for reviving the Silent Bob curation on creativecoin in a few months. While I'm not a huge fan of synchronous python, I decided on beempy for the bot. Tracing the curation commands on the chain works just fine, but when I try to take some actual action using the posting key of the bot, I keep getting WalletLocked exceptions. But I'm not using a wallet, just the posting key, because I want my bot to be running in docker on my NAS.
I hope maybe someone in the HiveDevs community can help me out to get this working.
In the constructor of my bot I'm doing something like this:
class SilentBot:
def __init__(self, wif, rewind=5):
self.stm = Hive(node="https://api.hive.blog", keys=[wif])
self.account = Account(self.stm.wallet.getAccountFromPrivateKey(wif))
...
Then, later in my code:
def star(self, author, permlink, star_count):
comment = Comment("@" + author + "/" + permlink)
power_up = (comment.json()["percent_hbd"] == 0)
if star_count > 5:
star_count = 5
if star_count < 1:
star_count = 1
config = self.lookup[power_up][star_count]
body = '
'
comment.reply(body=body, author=self.account)
print("STAR", star_count, power_up, author, permlink, config["percentage"])
self.vote_queue.append([config["percentage"], author, permlink])
At the moment comment.reply gets called I end up with a WalletLocked exception:
BLOCK: 59453240
BLOCK: 59453241
Traceback (most recent call last):
File "./silentbot.py", line 141, in <module>
bot.run()
File "./silentbot.py", line 129, in run
count = self.upto_head()
File "./silentbot.py", line 111, in upto_head
self.invocation(vals["parent_author"], vals["parent_permlink"], vals["body"])
File "./silentbot.py", line 90, in invocation
return self.star(author, permlink, star_count)
File "./silentbot.py", line 75, in star
comment.reply(body=body, author=self.account)
File "/home/rob-install/.local/lib/python3.6/site-packages/beem/comment.py", line 785, in reply
reply_identifier=self.identifier)
File "/home/rob-install/.local/lib/python3.6/site-packages/beem/blockchaininstance.py", line 2022, in post
return self.finalizeOp(ops, account, "posting", **kwargs)
File "/home/rob-install/.local/lib/python3.6/site-packages/beem/blockchaininstance.py", line 935, in finalizeOp
self.txbuffer.appendSigner(account, permission)
File "/home/rob-install/.local/lib/python3.6/site-packages/beem/transactionbuilder.py", line 247, in appendSigner
raise WalletLocked()
beemstorage.exceptions.WalletLocked
Does beempy only allow replies using a wallet? Or amy I doing something stupid here, resulting in this exception ? Or is beempy, just like my own discontinued async python library considered deprecated, and should I use another Python library for my project?