forked from hmflash/tikitank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tikitank.py
executable file
·49 lines (36 loc) · 919 Bytes
/
tikitank.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
#!/usr/bin/env python
import web
import json
from tank.Settings import Settings
render = web.template.render('templates')
s = Settings()
urls = (
'/', 'index',
'/settings', 'settings',
'/api/(\w+)/effects', 'effects',
'/api/(\w+)/effect', 'effect',
)
class index:
def GET(self):
return render.index()
class settings:
def GET(self):
web.header('Content-Type', 'application/json')
return json.dumps(s.get_settings())
def POST(self):
s.post_settings(web.input())
return self.GET()
class effects:
def GET(self, kind):
web.header('Content-Type', 'application/json')
return json.dumps(s.get_effects(kind))
class effect:
def GET(self, kind):
web.header('Content-Type', 'application/json')
return json.dumps(s.get_effect(kind))
def POST(self, kind):
s.set_effect(kind, web.input())
return self.GET(kind)
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()