blob: 76e9f4aa3c87ab84b1344986085fb8fd6ea6b2c7 [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
James E. King III3ec40312019-01-31 18:35:51 -05008
ra779b9ac2014-04-23 20:04:23 -07009class HelloSvcHandler:
James E. King III3ec40312019-01-31 18:35:51 -050010 def hello_func(self):
11 print("Hello Called")
12 return "hello from Python"
13
ra779b9ac2014-04-23 20:04:23 -070014
15processor = HelloSvc.Processor(HelloSvcHandler())
16protoFactory = TJSONProtocol.TJSONProtocolFactory()
17port = 9090
18server = THttpServer.THttpServer(processor, ("localhost", port), protoFactory)
19print "Python server running on port " + str(port)
20server.serve()