Created
March 9, 2017 19:47
-
-
Save waltervargas/ff4cfcf30e20b304b136c8162efb5837 to your computer and use it in GitHub Desktop.
Python version for webui.py used by dockercoins -> https://github.com/jpetazzo/dockercoins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask import jsonify | |
from redis import Redis | |
import time | |
app = Flask(__name__, static_url_path="") | |
redis = Redis('redis') | |
@app.route('/') | |
def root(): | |
return app.send_static_file('index.html') | |
@app.route('/json') | |
def json(): | |
coins = redis.hlen('wallet') | |
hashes = redis.get('hashes') | |
now = time.time() | |
return jsonify( | |
coins=coins, | |
hashes=int(hashes), | |
now=now | |
) | |
if __name__ == "__main__": | |
app.run(host="0.0.0.0", port=80) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jpetazzo here a python version of the webui.js file.