Get current data from a remote agent.
(agent_id: int, mode: str)
| 466 | |
| 467 | @controller_bp.route('/agents/<int:agent_id>/<mode>/data', methods=['GET']) |
| 468 | def proxy_mode_data(agent_id: int, mode: str): |
| 469 | """Get current data from a remote agent.""" |
| 470 | agent = get_agent(agent_id) |
| 471 | if not agent: |
| 472 | return api_error('Agent not found', 404) |
| 473 | |
| 474 | try: |
| 475 | client = create_client_from_agent(agent) |
| 476 | result = client.get_mode_data(mode) |
| 477 | |
| 478 | # Tag data with agent info |
| 479 | result['agent_id'] = agent_id |
| 480 | result['agent_name'] = agent['name'] |
| 481 | |
| 482 | return jsonify({ |
| 483 | 'status': 'success', |
| 484 | 'agent_id': agent_id, |
| 485 | 'agent_name': agent['name'], |
| 486 | 'mode': mode, |
| 487 | 'data': result |
| 488 | }) |
| 489 | |
| 490 | except (AgentHTTPError, AgentConnectionError) as e: |
| 491 | return api_error(f'Agent error: {e}', 502) |
| 492 | |
| 493 | |
| 494 | @controller_bp.route('/agents/<int:agent_id>/<mode>/stream') |
nothing calls this directly
no test coverage detected