From 9d22c9c9ee8cf068c138db3478cc8040ba593905 Mon Sep 17 00:00:00 2001 From: Holger Nahrstaedt <holger@nahrstaedt.de> Date: Mon, 12 Mar 2018 23:04:33 +0100 Subject: [PATCH] fix flake8 --- beem/steem.py | 2 +- beemgrapheneapi/graphenerpc.py | 10 +++++----- examples/op_on_testnet.py | 9 +++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/beem/steem.py b/beem/steem.py index 2012c2b7..b958a4b5 100644 --- a/beem/steem.py +++ b/beem/steem.py @@ -99,7 +99,7 @@ class Steem(object): data_refresh_time_seconds=900, **kwargs): """Init steem - + :param str node: Node to connect to *(optional)* :param str rpcuser: RPC user *(optional)* :param str rpcpassword: RPC password *(optional)* diff --git a/beemgrapheneapi/graphenerpc.py b/beemgrapheneapi/graphenerpc.py index 069d9400..08dd3344 100644 --- a/beemgrapheneapi/graphenerpc.py +++ b/beemgrapheneapi/graphenerpc.py @@ -80,7 +80,7 @@ class GrapheneRPC(object): """ - def __init__(self, urls, user="", password="", **kwargs): + def __init__(self, urls, user=None, password=None, **kwargs): """Init.""" self.api_id = {} self.rpc_methods = {'offline': -1, 'ws': 0, 'jsonrpc': 1, 'appbase': 2, 'wsappbase': 3} @@ -117,8 +117,8 @@ class GrapheneRPC(object): if self.urls is None: return while True: - cnt += 1 - if next_url: + cnt += 1 + if next_url: self.url = next(self.urls) log.debug("Trying to connect to node %s" % self.url) if self.url[:3] == "wss": @@ -169,7 +169,7 @@ class GrapheneRPC(object): def rpclogin(self, user, password): """Login into Websocket""" - if self.ws and self.current_rpc == 0: + if self.ws and self.current_rpc == 0 and user and password: self.login(user, password, api_id=1) def rpcclose(self): @@ -221,7 +221,7 @@ class GrapheneRPC(object): raise except WebSocketConnectionClosedException: self.rpcconnect(next_url=False) - self.register_apis() + self.register_apis() except Exception as e: log.critical("Error: {}\n".format(str(e))) sleep_and_check_retries(self.num_retries, cnt, self.url) diff --git a/examples/op_on_testnet.py b/examples/op_on_testnet.py index 4d8d1c48..3e6e8933 100644 --- a/examples/op_on_testnet.py +++ b/examples/op_on_testnet.py @@ -19,14 +19,15 @@ from beemgrapheneapi.rpcutils import NumRetriesReached log = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO) -password = "yfABsiDXWcCVyDC2udXGYD2psFUiQy" -password1 = "4JkeGCG3HghMMdwCpHyXpiZqoXbWuv" +password = "secretPassword" +username = "beem" + if __name__ == "__main__": stm = Steem(node=["wss://testnet.steem.vc"]) prefix = stm.prefix - # curl --data "username=beem&password=yfABsiDXWcCVyDC2udXGYD2psFUiQy" https://testnet.steem.vc/create - account = Account("beem", steem_instance=stm) + # curl --data "username=username&password=secretPassword" https://testnet.steem.vc/create + account = Account(username, steem_instance=stm) stm.wallet.purge() stm.wallet.create("123") stm.wallet.unlock("123") -- GitLab