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 "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
|
# Loop through gifts
|
||||||
referals = {}
|
referals = {}
|
||||||
for gift in gifts:
|
for gift_item in gifts:
|
||||||
if gift['referer'] not in referals:
|
if gift_item['referer'] not in referals:
|
||||||
referals[gift['referer']] = 1
|
referals[gift_item['referer']] = 1
|
||||||
else:
|
else:
|
||||||
referals[gift['referer']] += 1
|
referals[gift_item['referer']] += 1
|
||||||
|
|
||||||
statsHTML = 'Total gifts: ' + str(len(gifts)) + '<br><br>'
|
statsHTML = 'Total gifts: ' + str(len(gifts)) + '<br><br>'
|
||||||
statsHTML += 'Referals:<br>'
|
statsHTML += 'Referals:<br>'
|
||||||
@ -88,7 +88,7 @@ def stats():
|
|||||||
statsHTML += referal + ': ' + str(referals[referal]) + '<br>'
|
statsHTML += referal + ': ' + str(referals[referal]) + '<br>'
|
||||||
|
|
||||||
|
|
||||||
|
statsHTML += '<br>Remaining HNS: ' + str(gift.balance()) + '<br>'
|
||||||
|
|
||||||
return render_template('stats.html',address=address,stats=statsHTML)
|
return render_template('stats.html',address=address,stats=statsHTML)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user