diff --git a/beem/steem.py b/beem/steem.py index 2012c2b7c38e011b3726d0f0a57b25b3650d9cba..b958a4b5c21c14207ac3f270c81812d1918a9e1e 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 069d9400a5726242475a71e59b6f5ddb237ca0e4..08dd334492e423581f44e238db10cf9a91ea0483 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 4d8d1c48eebfc082bb776d018fdb775570e25f24..3e6e8933af21706b9d4b901e38a1d9f8f3a73063 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")