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')
|
||||
def api_data():
|
||||
summary = miner_api.summary()
|
||||
devs = miner_api.devs()
|
||||
pools = miner_api.pools()
|
||||
stats = miner_api.stats()
|
||||
|
||||
# Process data for easier frontend consumption
|
||||
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)
|
||||
try:
|
||||
summary = miner_api.summary()
|
||||
devs = miner_api.devs()
|
||||
pools = miner_api.pools()
|
||||
stats = miner_api.stats()
|
||||
|
||||
# Debug prints to console (visible in journalctl)
|
||||
if not summary: print("API Error: Summary is None")
|
||||
if not devs: print("API Error: Devs is None")
|
||||
|
||||
# Process data for easier frontend consumption
|
||||
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')
|
||||
def api_log():
|
||||
|
||||
Reference in New Issue
Block a user