-
Notifications
You must be signed in to change notification settings - Fork 74
/
boto.py
44 lines (29 loc) · 993 Bytes
/
boto.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
"""
This is the template server side for ChatBot
"""
from bottle import route, run, template, static_file, request
import json
@route('/', method='GET')
def index():
return template("chatbot.html")
@route("/chat", method='POST')
def chat():
user_message = request.POST.get('msg')
return json.dumps({"animation": "inlove", "msg": user_message})
@route("/test", method='POST')
def chat():
user_message = request.POST.get('msg')
return json.dumps({"animation": "inlove", "msg": user_message})
@route('/js/<filename:re:.*\.js>', method='GET')
def javascripts(filename):
return static_file(filename, root='js')
@route('/css/<filename:re:.*\.css>', method='GET')
def stylesheets(filename):
return static_file(filename, root='css')
@route('/images/<filename:re:.*\.(jpg|png|gif|ico)>', method='GET')
def images(filename):
return static_file(filename, root='images')
def main():
run(host='localhost', port=7000)
if __name__ == '__main__':
main()