|
- from twisted.web import server, resource
- from twisted.internet import reactor
-
- class Simple(resource.Resource):
- isLeaf = True
- def render_GET(self, request):
- request.setHeader("Content-Type", "text/html; charset=utf-8")
- return "<html>Hello, world!</html>".encode('utf-8')
-
- site = server.Site(Simple())
- reactor.listenTCP(8081, site)
- reactor.run()
|