RE: Python Libraries: Simple... Display your Splinterlands DEC
You are viewing a single comment's thread:
Well, you piqued my interest!
This got me to install Python 3 and, using PIP to add the requests repository.
After all that I thought I would contribute by adding a total...
Altered the code as follows:
import json, requests
splinterlands_accounts = ["account1", "account2", "account3"]
print("----------------------------------")
print("Account DEC Total")
print("----------------------------------")
totalDEC = float("0")
for account in splinterlands_accounts:
url = "https://api2.splinterlands.com/players/balances?username=" + account
spldata = json.loads(requests.get(url).text)
for data in spldata:
if data["token"] == "DEC":
spaces = " " * (20-len(data['player']))
print("{} {} {}".format(data['player'], spaces, data['balance']))
totalDEC = totalDEC + float(data['balance'])
print("----------------------------------")
spaces = " " * (18-len(str(totalDEC)))
print("{} {} {}".format("Total DEC", spaces, str(totalDEC)))
print("----------------------------------")
0
0
0.000
Great, have a go at doing something else, and install the BEEM library.., then you can truly manipulate HIVE stuff.