25 lines
687 B
Python
25 lines
687 B
Python
from flask import Flask, jsonify
|
|
from timber import axe, LumberJack
|
|
from config import _CLIENT_CONFIG
|
|
|
|
_VERSION = '0.1.1'
|
|
lumber = LumberJack()
|
|
lumber.set_log_level('i')
|
|
app = Flask(__name__)
|
|
|
|
@app.route('/power/<hostname>', methods=['GET'])
|
|
def get_status(hostname):
|
|
axe.info(f'Sending power 200 to {hostname}')
|
|
return hostname, 200
|
|
|
|
@app.route('/power/_VERSION', methods=['GET'])
|
|
def get_version():
|
|
return _VERSION, 200
|
|
|
|
@app.route('/power/_CONFIG/client/<hostname>', methods=['GET'])
|
|
def get_client_config(hostname):
|
|
axe.info(f'Config request from {hostname}')
|
|
return jsonify(_CLIENT_CONFIG), 200
|
|
|
|
if __name__ == '__main__':
|
|
app.run(debug=True, host='0.0.0.0') |