Пример #1
0
    def __init__(self, port=8080):
        BaseService.__init__(self)

        # Create a site structure
        root = static.Data("placeholder", "text/plain")
        root.putChild("", static.Data("Index", "text/plain"))
        self.site = server.Site(root)

        # Actually service the site
        s = strports.service("tcp:%d" % port, self.site)
        s.setServiceParent(self)
Пример #2
0
    def __init__(self, port=8787):
        BaseService.__init__(self)

        boiler = None
        portal = Portal(PbRealm(boiler))

        checker = InMemoryUsernamePasswordDatabaseDontUse()
        checker.addUser("guest", "guest")
        portal.registerChecker(checker)

        service = strports.service("tcp:%d" % port, pb.PBServerFactory(portal))
        service.setServiceParent(self)