Skip to content
Snippets Groups Projects
Commit 9d22c9c9 authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

fix flake8

parent 5d3d31b2
No related branches found
No related tags found
No related merge requests found
......@@ -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)*
......
......@@ -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)
......
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment