blob: bf3ef14a247b5bb2fbe6aeca2ba5fe48c3aebaa8 [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)
Alexandre Detiste8f9fba82024-08-28 14:28:39 +020019print("Python server running on port " + str(port))
ra779b9ac2014-04-23 20:04:23 -070020server.serve()