-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestbackend.py
More file actions
48 lines (43 loc) · 1.39 KB
/
testbackend.py
File metadata and controls
48 lines (43 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from flask import Flask, request, jsonify
import json
app = Flask(__name__)
httpHeaders = {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "OPTIONS,POST,GET,PUT,DELETE",
}
@app.route('/api/job', methods=['GET'])
def getTest():
result = {
"job": {
"averagePrintTime": 38923.424780887,
"estimatedPrintTime": 33079.77878218678,
"filament": {
"tool0": {
"length": 30124.544599997087,
"volume": 0.0
}
},
"file": {
"date": 1563137072,
"display": "nespresso-holder_10h5min_30,09_90_1,97.gcode",
"name": "nespresso-holder_10h5min_30-09_90_1-97.gcode",
"origin": "local",
"path": "Queue/nespresso-holder_10h5min_30-09_90_1-97.gcode",
"size": 8960200
},
"lastPrintTime": 38923.424780887,
"user": "OliverBenz"
},
"progress": {
"completion": 100.0,
"filepos": 8960200,
"printTime": 38923,
"printTimeLeft": 0,
"printTimeLeftOrigin": 0
},
"state": "Operational"
}
return jsonify(result), 200, httpHeaders
if __name__ == "__main__":
app.run(host='0.0.0.0', port=3004)