From f94bb088f2f244517266db3942b61aed5ae32619 Mon Sep 17 00:00:00 2001 From: Gemini Bot Date: Tue, 20 Jan 2026 13:38:01 +0000 Subject: [PATCH] Add debug output to api/data endpoint --- app.py | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/app.py b/app.py index 0cd9257..538db24 100644 --- a/app.py +++ b/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():