We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f971bdc commit 140bea3Copy full SHA for 140bea3
1 file changed
cloudbot/web.py
@@ -0,0 +1,33 @@
1
+import asyncio
2
+
3
+from tornado.web import RequestHandler, Application, url
4
+from tornado.platform.asyncio import AsyncIOMainLoop
5
6
7
+def get_application():
8
+ app = Application([
9
+ url('/', TestHandler)
10
+ ])
11
+ return app
12
13
14
+class TestHandler(RequestHandler):
15
+ def get(self):
16
+ self.write("Hello world!\n")
17
18
19
+class WebInterface():
20
+ def __init__(self, bot, port=8080, address="0.0.0.0"):
21
+ self.bot = bot
22
+ self.port = port
23
+ self.address = address
24
25
+ self.app = None
26
27
+ # Install tornado IO loop.
28
+ AsyncIOMainLoop().install()
29
30
+ def start(self):
31
+ """ Starts the CloudBot web application """
32
+ self.app = get_application()
33
+ self.app.listen(self.port, address=self.address)
0 commit comments