From 96e98c3a9c795183f587612ace1a3b481735fe68 Mon Sep 17 00:00:00 2001 From: Holger <holger@nahrstaedt.de> Date: Sun, 25 Nov 2018 21:21:42 +0100 Subject: [PATCH] Add uploadimage to beempy --- beem/cli.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/beem/cli.py b/beem/cli.py index 2de7923b..30c51a03 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -44,6 +44,7 @@ from beemgraphenebase.account import PrivateKey, PublicKey, BrainKey from beemgraphenebase.base58 import Base58 from beem.nodelist import NodeList from beem.conveyor import Conveyor +from beem.imageuploader import ImageUploader from beem.rc import RC @@ -1485,6 +1486,27 @@ def beneficiaries(authorperm, beneficiaries): print(tx) +@cli.command() +@click.argument('image', nargs=1) +@click.option('--account', '-a', help='Account name') +@click.option('--image-name', '-n', help='Image name') +def uploadimage(image, account, image_name): + stm = shared_steem_instance() + if stm.rpc is not None: + stm.rpc.rpcconnect() + if not account: + account = stm.config["default_account"] + author = account + if not unlock_wallet(stm): + return + iu = ImageUploader(steem_instance=stm) + tx = iu.upload(image, account, image_name) + if image_name is None: + print("" % tx["url"]) + else: + print("" % (image_name, tx["url"])) + + @cli.command() @click.argument('body', nargs=1) @click.option('--account', '-a', help='Account are you posting from') -- GitLab