Ticket #7274: server.py

File server.py, 446 bytes (added by Daniel Sank, 8 years ago)

The runnable server

Line 
1import twisted.spread.pb as pb
2
3import resources
4
5from twisted.internet import reactor
6from twisted.cred import portal, checkers
7
8def main():
9    realm = resources.Server()
10    checker = checkers.InMemoryUsernamePasswordDatabaseDontUse()
11    checker.addUser("alice", "1234")
12    p = portal.Portal(realm, [checker])
13   
14    reactor.listenTCP(8800, pb.PBServerFactory(p))
15    reactor.run()
16
17if __name__ == "__main__":
18    main()