Add debug output to api/data endpoint
This commit is contained in:
34
app.py
34
app.py
@@ -28,19 +28,27 @@ def settings():
|
|||||||
|
|
||||||
@app.route('/api/data')
|
@app.route('/api/data')
|
||||||
def api_data():
|
def api_data():
|
||||||
summary = miner_api.summary()
|
try:
|
||||||
devs = miner_api.devs()
|
summary = miner_api.summary()
|
||||||
pools = miner_api.pools()
|
devs = miner_api.devs()
|
||||||
stats = miner_api.stats()
|
pools = miner_api.pools()
|
||||||
|
stats = miner_api.stats()
|
||||||
# Process data for easier frontend consumption
|
|
||||||
data = {
|
# Debug prints to console (visible in journalctl)
|
||||||
'summary': summary['SUMMARY'][0] if summary and 'SUMMARY' in summary else {},
|
if not summary: print("API Error: Summary is None")
|
||||||
'devs': devs['DEVS'] if devs and 'DEVS' in devs else [],
|
if not devs: print("API Error: Devs is None")
|
||||||
'pools': pools['POOLS'] if pools and 'POOLS' in pools else [],
|
|
||||||
'stats': stats if stats else {}
|
# Process data for easier frontend consumption
|
||||||
}
|
data = {
|
||||||
return jsonify(data)
|
'summary': summary['SUMMARY'][0] if summary and 'SUMMARY' in summary else {},
|
||||||
|
'devs': devs['DEVS'] if devs and 'DEVS' in devs else [],
|
||||||
|
'pools': pools['POOLS'] if pools and 'POOLS' in pools else [],
|
||||||
|
'stats': stats if stats else {}
|
||||||
|
}
|
||||||
|
return jsonify(data)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"API Data Error: {e}")
|
||||||
|
return jsonify({'error': str(e)})
|
||||||
|
|
||||||
@app.route('/api/log')
|
@app.route('/api/log')
|
||||||
def api_log():
|
def api_log():
|
||||||
|
|||||||
Reference in New Issue
Block a user