删除遗漏的api test数据

This commit is contained in:
2026-05-09 16:44:28 +08:00
parent 75ceec0798
commit 42e3050fa2

View File

@@ -40,60 +40,16 @@ def require_api_key(f):
@api_bp.route('/status', methods=['GET'])
@require_api_key
def get_status():
test_data = {
'job': {
'job': {
'estimatedPrintTime': 1234,
'filament': {'length': 765, 'volume': 24356},
'file': {'display_name': 'Test File','date': None, 'name': '20260414135441_42bff5215c6148b8b5f4d8c4f15d5ddc.gcode', 'origin': 'local', 'path': None, 'size': 1468987},
'lastPrintTime': None,
'user': None
},
'progress': {
'completion': 74.8,
'filepos': 1234,
'printTime': 1235,
'printTimeLeft': 6353,
'printTimeLeftOrigin': 5366
},
'state': 'Operational'
},
'status': {
'sd': {'ready': False},
'state': {
'error': '',
'flags': {
'cancelling': False,
'closedOrError': False,
'error': False,
'finishing': False,
'operational': True,
'paused': False,
'pausing': False,
'printing': False,
'ready': True,
'resuming': False,
'sdReady': False
},
'text': 'Operational test'
},
'temperature': {
'bed': {'actual': 85, 'offset': 0, 'target': 56},
'tool0': {'actual': 0.0, 'offset': 0, 'target': 340}
}
}
}
return jsonify(test_data)
# client = get_octo_client()
# if not client:
# return jsonify({'error': 'Printer not configured'}), 503
# try:
# status_data = client.get_printer_status()
# job_data = client.get_job_info()
# job_data = _enrich_job_data(job_data)
# return jsonify({'status': status_data, 'job': job_data})
# except Exception as e:
# return jsonify({'error': str(e)}), 500
client = get_octo_client()
if not client:
return jsonify({'error': 'Printer not configured'}), 503
try:
status_data = client.get_printer_status()
job_data = client.get_job_info()
job_data = _enrich_job_data(job_data)
return jsonify({'status': status_data, 'job': job_data})
except Exception as e:
return jsonify({'error': str(e)}), 500
@api_bp.route('/octoprint_client', methods=['POST'])
@require_api_key