-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebt.py
More file actions
executable file
·33 lines (26 loc) · 732 Bytes
/
Copy pathwebt.py
File metadata and controls
executable file
·33 lines (26 loc) · 732 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
#!/usr/bin/python
#
import web
urls = (
'/device/*(.*)', 'device',
'/(.*)', 'default'
)
global foo
foo = False
app = web.application(urls, globals())
class default:
def GET(self, name):
if not name:
name = 'World'
return 'Default, ' + name + '!'
class device:
def GET(self, command):
if not command:
name = 'Notdefined'
udata = web.input(cname="not_defined",st=0)
print web.fvars
dip = web.ctx['ip']
print('Device: ' + dip + ' command='+ command + ' cname=' + udata.cname + ' st=' + str(udata.st))
return 'Device: ' + name + ' cname=' + udata.cname + ' st=' + str(udata.st) + '!'
if __name__ == "__main__":
app.run()