blob: b8ba5861fcc3e1714680490dca1ac636e30d00af [file] [log] [blame]
ra779b9ac2014-04-23 20:04:23 -07001import sys
2sys.path.append('gen-py')
3
4from hello import HelloSvc
5from thrift.protocol import TJSONProtocol
6from thrift.server import THttpServer
7
8class HelloSvcHandler:
9 def hello_func(self):
10 print "Hello Called"
11 return "hello from Python"
12
13processor = HelloSvc.Processor(HelloSvcHandler())
14protoFactory = TJSONProtocol.TJSONProtocolFactory()
15port = 9090
16server = THttpServer.THttpServer(processor, ("localhost", port), protoFactory)
17print "Python server running on port " + str(port)
18server.serve()
19