Fix crypto script
This commit is contained in:
parent
1f24e2c034
commit
2f40c6d1a2
@ -5,17 +5,22 @@ import json
|
|||||||
|
|
||||||
|
|
||||||
def __LBC():
|
def __LBC():
|
||||||
data = subprocess.run(
|
try:
|
||||||
["lbrynet", "account", "list"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
data = subprocess.run(
|
||||||
)
|
["lbrynet", "account", "list"],
|
||||||
if data.stderr != b'':
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
)
|
||||||
|
if data.stderr != b"":
|
||||||
|
return None
|
||||||
|
data = json.loads(data.stdout)
|
||||||
|
balance: float = 0
|
||||||
|
for i in range(len(data["items"])):
|
||||||
|
d = data["items"][i]["coins"]
|
||||||
|
balance += float(d)
|
||||||
|
return round(balance, 1)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
return None
|
return None
|
||||||
data = json.loads(data.stdout)
|
|
||||||
balance: float = 0
|
|
||||||
for i in range(len(data["items"])):
|
|
||||||
d = data["items"][i]["coins"]
|
|
||||||
balance += float(d)
|
|
||||||
return round(balance, 1)
|
|
||||||
|
|
||||||
|
|
||||||
def __DOGE():
|
def __DOGE():
|
||||||
@ -25,7 +30,7 @@ def __DOGE():
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
)
|
)
|
||||||
if data.stderr != b'':
|
if data.stderr != b"":
|
||||||
return None
|
return None
|
||||||
balance = json.loads(data.stdout)
|
balance = json.loads(data.stdout)
|
||||||
return round(balance, 1)
|
return round(balance, 1)
|
||||||
@ -40,7 +45,7 @@ def __BTC():
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
)
|
)
|
||||||
if data.stderr != b'':
|
if data.stderr != b"":
|
||||||
return None
|
return None
|
||||||
balance = json.loads(data.stdout)
|
balance = json.loads(data.stdout)
|
||||||
return round(balance, 1)
|
return round(balance, 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user