-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstub.py
More file actions
45 lines (39 loc) · 785 Bytes
/
stub.py
File metadata and controls
45 lines (39 loc) · 785 Bytes
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
# pip3 install Flask
# python3 server.py
from flask import Flask
from flask import jsonify
app = Flask(__name__)
systemStatsData = {
'battery' : {
'status' : 0,
'level' : 55
},
'network' : {
'type' : 'wifiAP',
'ssid' : '',
'passphrase' : '',
'level' : 90
},
'load' : {
'totalRAM' : 2048,
'usedRAM' : 400,
'avgLoad' : [20,4],
'temp' : 34
}
}
hwInfoData = {
'model' : 'CDRBT-01-2017-1',
'serial' : '740129387591e',
'core-sw-version' : '0.3.1a',
'web-sw-version' : '0.1-prelease',
'last-update' : '2018-1-1',
'name' : 'CoderBot di Antonio',
'raspbian-version' : '9.3-stretch',
}
@app.route("/api/systemStats")
def systemStats():
return jsonify(systemStatsData)
@app.route("/api/hwInfo")
def hwInfo():
return jsonify(hwInfoData)
app.run(debug=True)