-
Notifications
You must be signed in to change notification settings - Fork 0
/
WalletBalances.py
26 lines (18 loc) · 4.92 KB
/
WalletBalances.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import json, subprocess, configparser
from datetime import datetime
from pushover import init, Client
PushoverEnabled = 1
walletDetails = json.loads(subprocess.check_output("dcrctl --wallet getbalance", shell=True))
if len(walletDetails) > 0:
lockedByTickets = walletDetails["totallockedbytickets"]
spendable = walletDetails["totalspendable"]
total = walletDetails["cumulativetotal"]
strWalletBalance = "Locked By Tickets: " + str(lockedByTickets) + "\n" + "Spendable: " + str(spendable) + "\n" + "Total: " + str(total)
print(strWalletBalance)
if (PushoverEnabled and len(walletDetails) > 0):
config = configparser.ConfigParser()
config.read("config.ini")
PushoverToken = config["DEFAULT"]["PushoverToken"]
PushoverUserKey = config["DEFAULT"]["PushoverUserKey"]
init(PushoverToken)
Client(PushoverUserKey).send_message(strWalletBalance, title="DCR Wallet Balance")