This commit is contained in:
parent
29a0a128fb
commit
45b56dc3cb
12
gift.py
12
gift.py
@ -116,4 +116,14 @@ def gift(name,email,referer, ip):
|
||||
return "Error sending gift:<br>" + send_name.text
|
||||
|
||||
|
||||
return True
|
||||
return True
|
||||
|
||||
def balance():
|
||||
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
||||
user_info = requests.get(nb_endpoint + "/api/user",headers=headers, cookies=cookies)
|
||||
if user_info.status_code != 200:
|
||||
return "Error getting user info:<br>" + user_info.text
|
||||
user_info = user_info.json()
|
||||
hns_balance = user_info['hns_balance']
|
||||
hns_balance = int(hns_balance)/1000000
|
||||
return hns_balance
|
||||
|
10
main.py
10
main.py
@ -76,11 +76,11 @@ def stats():
|
||||
|
||||
# Loop through gifts
|
||||
referals = {}
|
||||
for gift in gifts:
|
||||
if gift['referer'] not in referals:
|
||||
referals[gift['referer']] = 1
|
||||
for gift_item in gifts:
|
||||
if gift_item['referer'] not in referals:
|
||||
referals[gift_item['referer']] = 1
|
||||
else:
|
||||
referals[gift['referer']] += 1
|
||||
referals[gift_item['referer']] += 1
|
||||
|
||||
statsHTML = 'Total gifts: ' + str(len(gifts)) + '<br><br>'
|
||||
statsHTML += 'Referals:<br>'
|
||||
@ -88,7 +88,7 @@ def stats():
|
||||
statsHTML += referal + ': ' + str(referals[referal]) + '<br>'
|
||||
|
||||
|
||||
|
||||
statsHTML += '<br>Remaining HNS: ' + str(gift.balance()) + '<br>'
|
||||
|
||||
return render_template('stats.html',address=address,stats=statsHTML)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user