Script to get Wallet [Account] balances, number of Hotspots

I wrote a basic little script in Python 3.7 to list all Wallets, their total HNT, and how many hotspots each Wallet has.

Example output:

HNT: 1112026.95509444, Address: 13jL4pTLq4JQBwDoH1ZBX3VPchmeTZxQSGi4cnyXXuzPPoKxcd5: Hotspot Count: 44
HNT: 1067191.26159254, Address: 1398hLeHESZHE5jVtaLAV5fdg2vrUeZEs2B92t7TzeQTtugr8dL: Hotspot Count: 0
HNT: 474146.27071588, Address: 14GWyFj9FjLHzoN3aX7Tq7PL6fEg4dfWPY8CrK8b9S5ZrcKDz6S: Hotspot Count: 0
HNT: 473557.93198784, Address: 12yyntxFfPhqXDKuEvmAWABNTRnXtYmcgS33WN4tk5YtyaBLDXo: Hotspot Count: 0

Here’s the code:

import requests

url = ""

response = requests.request("GET", url).json()
data = response['data'].sort(key=lambda x: x['balance'], reverse=True)


with open("account_hotspots", "a") as file:
    for value in response['data']:
        account_url = f"{value['address']}/gateways"
        account_response = requests.request("GET", account_url).json()
        hotspot_counts = len(account_response['data'])
        file.write(f"HNT: {int(value['balance']) / 100000000}, Address: {value['address']}: Hotspot Count: {hotspot_counts}\n")
        print(f"HNT: {int(value['balance']) / 100000000}, Address: {value['address']}: Hotspot Count: {hotspot_counts}")


  • This may take a while depending on how large the network gets
1 Like