From 76df1cb3bd2d89a6ea06f17c7e6fe6be3407474b Mon Sep 17 00:00:00 2001 From: Holger <holger@nahrstaedt.de> Date: Thu, 9 Aug 2018 09:46:24 +0200 Subject: [PATCH] Prepare next version * steemd.pevo.science and steemd.steemgigs.org removed from Nodelist * bug fixed in allow and disallow for CLI * fix #64 * Show results for get_user_data and get_feature_flags in Conveyor --- README.rst | 8 +++++ beem/block.py | 4 +-- beem/blockchain.py | 2 +- beem/cli.py | 63 +++++++++++++++++++++++++++++++++++++ beem/conveyor.py | 20 ++++++++---- beem/nodelist.py | 8 ++--- beem/version.py | 2 +- beemapi/version.py | 2 +- beembase/version.py | 2 +- beemgraphenebase/version.py | 2 +- setup.py | 2 +- 11 files changed, 97 insertions(+), 18 deletions(-) diff --git a/README.rst b/README.rst index 96fce782..635e996a 100644 --- a/README.rst +++ b/README.rst @@ -156,6 +156,14 @@ before transmitting the packed file. Please check the hash-sum after downloading Changelog ========= +0.19.53 +------- +* Add userdata and featureflags to beempy +* steemd.pevo.science and steemd.steemgigs.org removed from Nodelist +* bug fixed in allow and disallow for CLI +* Issue #52 closed thanks to crokkon +* Issue #64 fixed + 0.19.52 ------- * appbase.buildtime.io node added diff --git a/beem/block.py b/beem/block.py index 2deeb8e4..2421b4e8 100644 --- a/beem/block.py +++ b/beem/block.py @@ -166,7 +166,7 @@ class Block(BlockchainObject): return None def time(self): - """Return a datatime instance for the timestamp of this block""" + """Return a datetime instance for the timestamp of this block""" return self['timestamp'] @property @@ -342,7 +342,7 @@ class BlockHeader(BlockchainObject): ) def time(self): - """ Return a datatime instance for the timestamp of this block + """ Return a datetime instance for the timestamp of this block """ return self['timestamp'] diff --git a/beem/blockchain.py b/beem/blockchain.py index b287bc50..4495a21a 100644 --- a/beem/blockchain.py +++ b/beem/blockchain.py @@ -255,7 +255,7 @@ class Blockchain(object): raise OfflineHasNoRPCException("No RPC available in offline mode!") self.steem.rpc.set_next_node_on_empty_reply(False) if self.steem.rpc.get_use_appbase(): - ret = self.steem.rpc.get_transaction({'id': transaction_id}, api="database") + ret = self.steem.rpc.get_transaction({'id': transaction_id}, api="account_history") else: ret = self.steem.rpc.get_transaction(transaction_id, api="database") return ret diff --git a/beem/cli.py b/beem/cli.py index d24292d3..7bccb6dc 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -41,6 +41,7 @@ from beembase import operations from beemgraphenebase.account import PrivateKey, PublicKey, BrainKey from beemgraphenebase.base58 import Base58 from beem.nodelist import NodeList +from beem.conveyor import Conveyor click.disable_unicode_literals_warning = True @@ -1145,6 +1146,8 @@ def allow(foreign_account, permission, account, weight, threshold): from beemgraphenebase.account import PasswordKey pwd = click.prompt("Password for Key Derivation", confirmation_prompt=True, hide_input=True) foreign_account = format(PasswordKey(account, pwd, permission).get_public(), stm.prefix) + if threshold is not None: + threshold = int(threshold) tx = acc.allow(foreign_account, weight=weight, permission=permission, threshold=threshold) if stm.unsigned and stm.nobroadcast and stm.steemconnect is not None: tx = stm.steemconnect.url_from_tx(tx) @@ -1170,6 +1173,8 @@ def disallow(foreign_account, permission, account, threshold): if permission not in ["posting", "active", "owner"]: print("Wrong permission, please use: posting, active or owner!") return + if threshold is not None: + threshold = int(threshold) acc = Account(account, steem_instance=stm) if not foreign_account: from beemgraphenebase.account import PasswordKey @@ -2988,6 +2993,64 @@ def info(objects): print("Couldn't identify object to read") +@cli.command() +@click.argument('account', nargs=1, required=False) +@click.option('--signing-account', '-s', help='Signing account, when empty account is used.') +def userdata(account, signing_account): + """ Get the account's email address and phone number. + + The request has to be signed by the requested account or an admin account. + """ + stm = shared_steem_instance() + if stm.rpc is not None: + stm.rpc.rpcconnect() + if not unlock_wallet(stm): + return + if not account: + if "default_account" in stm.config: + account = stm.config["default_account"] + account = Account(account, steem_instance=stm) + if signing_account is not None: + signing_account = Account(signing_account, steem_instance=stm) + c = Conveyor(steem_instance=stm) + user_data = c.get_user_data(account, signing_account=signing_account) + t = PrettyTable(["Key", "Value"]) + t.align = "l" + for key in user_data: + # hide internal config data + t.add_row([key, user_data[key]]) + print(t) + + +@cli.command() +@click.argument('account', nargs=1, required=False) +@click.option('--signing-account', '-s', help='Signing account, when empty account is used.') +def featureflags(account, signing_account): + """ Get the account's feature flags. + + The request has to be signed by the requested account or an admin account. + """ + stm = shared_steem_instance() + if stm.rpc is not None: + stm.rpc.rpcconnect() + if not unlock_wallet(stm): + return + if not account: + if "default_account" in stm.config: + account = stm.config["default_account"] + account = Account(account, steem_instance=stm) + if signing_account is not None: + signing_account = Account(signing_account, steem_instance=stm) + c = Conveyor(steem_instance=stm) + user_data = c.get_feature_flags(account, signing_account=signing_account) + t = PrettyTable(["Key", "Value"]) + t.align = "l" + for key in user_data: + # hide internal config data + t.add_row([key, user_data[key]]) + print(t) + + if __name__ == "__main__": if getattr(sys, 'frozen', False): os.environ['SSL_CERT_FILE'] = os.path.join(sys._MEIPASS, 'lib', 'cert.pem') diff --git a/beem/conveyor.py b/beem/conveyor.py index 9a2bb800..cdabe01f 100644 --- a/beem/conveyor.py +++ b/beem/conveyor.py @@ -163,9 +163,13 @@ class Conveyor(object): """ account = Account(account, steem_instance=self.steem) - return self._conveyor_method(account, signing_account, - "conveyor.get_user_data", - [account['name']]) + user_data = self._conveyor_method(account, signing_account, + "conveyor.get_user_data", + [account['name']]) + if "result" in user_data: + return user_data["result"] + else: + return user_data def set_user_data(self, account, params, signing_account=None): """ Set the account's email address and phone number. The request has to be @@ -212,9 +216,13 @@ class Conveyor(object): """ account = Account(account, steem_instance=self.steem) - return self._conveyor_method(account, signing_account, - "conveyor.get_feature_flags", - [account['name']]) + feature_flags = self._conveyor_method(account, signing_account, + "conveyor.get_feature_flags", + [account['name']]) + if "result" in feature_flags: + return feature_flags["result"] + else: + return feature_flags def get_feature_flag(self, account, flag, signing_account=None): """ Test if a specific feature flag is set for an account. The request diff --git a/beem/nodelist.py b/beem/nodelist.py index bf717279..aabfd825 100644 --- a/beem/nodelist.py +++ b/beem/nodelist.py @@ -143,14 +143,14 @@ class NodeList(list): "version": "0.19.2", "type": "normal", "owner": "pharesim", - "score": 10 + "score": -10 }, { "url": "https://steemd.pevo.science", "version": "0.19.3", "type": "normal", "owner": "pharesim", - "score": 10 + "score": -10 }, { "url": "wss://rpc.steemliberator.com", @@ -185,14 +185,14 @@ class NodeList(list): "version": "0.19.3", "type": "normal", "owner": "steemgigs", - "score": 10 + "score": -10 }, { "url": "https://steemd.steemgigs.org", "version": "0.19.3", "type": "normal", "owner": "steemgigs", - "score": 10 + "score": -10 }, { "url": "wss://steemd.minnowsupportproject.org", diff --git a/beem/version.py b/beem/version.py index bb55b1ea..d2caabe6 100644 --- a/beem/version.py +++ b/beem/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.19.52' +version = '0.19.53' diff --git a/beemapi/version.py b/beemapi/version.py index bb55b1ea..d2caabe6 100644 --- a/beemapi/version.py +++ b/beemapi/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.19.52' +version = '0.19.53' diff --git a/beembase/version.py b/beembase/version.py index bb55b1ea..d2caabe6 100644 --- a/beembase/version.py +++ b/beembase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.19.52' +version = '0.19.53' diff --git a/beemgraphenebase/version.py b/beemgraphenebase/version.py index bb55b1ea..d2caabe6 100644 --- a/beemgraphenebase/version.py +++ b/beemgraphenebase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.19.52' +version = '0.19.53' diff --git a/setup.py b/setup.py index 48e215d4..4a990bff 100755 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ except LookupError: ascii = codecs.lookup('ascii') codecs.register(lambda name, enc=ascii: {True: enc}.get(name == 'mbcs')) -VERSION = '0.19.52' +VERSION = '0.19.53' tests_require = ['mock >= 2.0.0', 'pytest', 'pytest-mock', 'parameterized'] -- GitLab