ThriftPy是ApacheThrift的Pytho语言移植版本。
服务器端示例代码:
import thriftpyfrom thriftpy.rpc import make_serverpigpog = thriftpy.load("pigpog.thrift")class Dispatcher(object): def pig(self): retur "pog"server = make_server(pigpog.PigPog, Dispatcher(), '127.0.0.1', 6000)server.serve()客户端:
import thriftpyfrom thrift.rpc import make_clietpigpog = thriftpy.load("pigpog.thrift")cliet = make_cliet(pigpog.PigPog, '127.0.0.1', 6000)cliet.pig()






评论