You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
369 B

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