-
Notifications
You must be signed in to change notification settings - Fork 1
/
web_reboot.py
53 lines (41 loc) · 1.27 KB
/
web_reboot.py
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
49
50
51
52
53
import os;
import globs;
from web_pyhtml import pyhtml_parser;
# Returns:
# <s:buffer>, <i:next_offset>
def GET(size_buf, offset, vardict, body): #{
print("web_reboot.GET(size_buf:%d, offset:%d, vardict, body)" % (size_buf, offset));
buf = '';
read = 0;
# Variables
title = globs.prod + " " + globs.desc;
ver = '<a href="' + globs.url + '">' \
+ title + " " + globs.ver + "<br>\n" \
+ "on " + os.uname().machine + " (" + os.uname().sysname + ") " + "<br>\n" \
+ "uPython " + os.uname().version + " (" + os.uname().release + ")" \
+ '</a>';
uid = globs.uid;
mac = globs.mac;
tag, buf, read = pyhtml_parser('web_reboot.pyhtml', size_buf, offset, vardict, body);
if (tag): #{
print("Processing py tag:|" + buf + "|");
buf = eval(buf, {
'title': title
,'ver': ver
,'uid': uid
,'mac': mac
});
#}
return buf, read;
#}
# Returns:
# <s:buffer>, <i:next_offset>
def endGET(size_buf, offset, vardict, body): #{
print("web_reboot.endGET(size_buf:%d, offset:%d, vardict, body)" % (size_buf, offset));
import machine;
import time;
time.sleep(5);
machine.reset();
return '', -1;
#}
# vim:ts=4:tw=80:sw=4:et:ai:si