fHDHR_NewsON/fHDHR/http/api/debug.py
deathbybandaid 8c5cd7371f first commit
2020-11-27 15:27:23 -05:00

30 lines
789 B
Python

from flask import request, Response
import json
class Debug_JSON():
endpoints = ["/api/debug"]
endpoint_name = "api_debug"
endpoint_methods = ["GET", "POST"]
def __init__(self, fhdhr):
self.fhdhr = fhdhr
def __call__(self, *args):
return self.get(*args)
def get(self, *args):
base_url = request.url_root[:-1]
debugjson = {
"base_url": base_url,
"total channels": len(self.fhdhr.device.channels.list),
"tuner status": self.fhdhr.device.tuners.status(),
}
cluster_json = json.dumps(debugjson, indent=4)
return Response(status=200,
response=cluster_json,
mimetype='application/json')