删除遗漏的api test数据
This commit is contained in:
@@ -40,60 +40,16 @@ def require_api_key(f):
|
|||||||
@api_bp.route('/status', methods=['GET'])
|
@api_bp.route('/status', methods=['GET'])
|
||||||
@require_api_key
|
@require_api_key
|
||||||
def get_status():
|
def get_status():
|
||||||
test_data = {
|
client = get_octo_client()
|
||||||
'job': {
|
if not client:
|
||||||
'job': {
|
return jsonify({'error': 'Printer not configured'}), 503
|
||||||
'estimatedPrintTime': 1234,
|
try:
|
||||||
'filament': {'length': 765, 'volume': 24356},
|
status_data = client.get_printer_status()
|
||||||
'file': {'display_name': 'Test File','date': None, 'name': '20260414135441_42bff5215c6148b8b5f4d8c4f15d5ddc.gcode', 'origin': 'local', 'path': None, 'size': 1468987},
|
job_data = client.get_job_info()
|
||||||
'lastPrintTime': None,
|
job_data = _enrich_job_data(job_data)
|
||||||
'user': None
|
return jsonify({'status': status_data, 'job': job_data})
|
||||||
},
|
except Exception as e:
|
||||||
'progress': {
|
return jsonify({'error': str(e)}), 500
|
||||||
'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
|
|
||||||
|
|
||||||
@api_bp.route('/octoprint_client', methods=['POST'])
|
@api_bp.route('/octoprint_client', methods=['POST'])
|
||||||
@require_api_key
|
@require_api_key
|
||||||
|
|||||||
Reference in New Issue
Block a user