I found the following example of a Twisted request handler. I'm not clear what the isLeaf
attribute is for. Why should I set it on a resource?
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.resource import Resource
class RequestHandler(Resource):
isLeaf = True
def render_GET(self, request):
request.setResponseCode(200)
return "HelloWorld"
if __name__ == '__main__':
resource = RequestHandler()
factory = Site(resource)
reactor.listenTCP(8001, factory)
reactor.run()