Compare commits
No commits in common. "3b7c587e54fc419b1ff387fa890552935c002015" and "784455fe1d4650ad02f732b635b739194c348268" have entirely different histories.
3b7c587e54
...
784455fe1d
28
main.py
28
main.py
@ -4,9 +4,6 @@ import dotenv
|
|||||||
import requests
|
import requests
|
||||||
import gift
|
import gift
|
||||||
import json
|
import json
|
||||||
import schedule
|
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
dotenv.load_dotenv()
|
dotenv.load_dotenv()
|
||||||
@ -100,7 +97,7 @@ def stats():
|
|||||||
statsHTML += referal + ': ' + str(referals[referal]) + '<br>'
|
statsHTML += referal + ': ' + str(referals[referal]) + '<br>'
|
||||||
|
|
||||||
|
|
||||||
statsHTML += '<br>Remaining balance: ' + str(gift.balance()) + ' HNS<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)
|
||||||
|
|
||||||
@ -120,28 +117,5 @@ def catch_all(path):
|
|||||||
def not_found(e):
|
def not_found(e):
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
|
|
||||||
def update_address():
|
|
||||||
global address
|
|
||||||
payload = {
|
|
||||||
"asset": "HNS",
|
|
||||||
# "timestamp": 1699411892673,
|
|
||||||
"timestamp": int(round(time.time() * 1000)),
|
|
||||||
"receiveWindow": 10000
|
|
||||||
}
|
|
||||||
nbcookie = os.getenv('cookie')
|
|
||||||
cookies = {"namebase-main": nbcookie}
|
|
||||||
headers = {"Accept": "application/json", "Content-Type": "application/json"}
|
|
||||||
r = requests.post('https://www.namebase.io/api/v0/deposit/address', data=json.dumps(payload), headers=headers, cookies=cookies)
|
|
||||||
address = r.json()['address']
|
|
||||||
print("Address updated: " + address,flush=True)
|
|
||||||
|
|
||||||
|
|
||||||
update_address()
|
|
||||||
|
|
||||||
# Schedule address update every hour
|
|
||||||
schedule.every(1).hour.do(update_address)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=False, port=5000, host='0.0.0.0')
|
app.run(debug=False, port=5000, host='0.0.0.0')
|
@ -2,5 +2,4 @@ flask
|
|||||||
python-dotenv
|
python-dotenv
|
||||||
gunicorn
|
gunicorn
|
||||||
requests
|
requests
|
||||||
pyotp
|
pyotp
|
||||||
schedule
|
|
Loading…
Reference in New Issue
Block a user