<s> import thriftpy <EOL> from thriftpy . rpc import client_context <EOL> from thriftpy . protocol import ( <EOL> TBinaryProtocolFactory , <EOL> TMultiplexedProtocolFactory <EOL> ) <EOL> dd_thrift = thriftpy . load ( "<STR_LIT>" , module_name = "<STR_LIT>" ) <EOL> pp_thrift = thriftpy . load ( "<STR_LIT>" , module_name = "<STR_LIT>" ) <EOL> DD_SERVICE_NAME = "<STR_LIT>" <EOL> PP_SERVICE_NAME = "<STR_LIT>" <EOL> def main ( ) : <EOL> binary_factory = TBinaryProtocolFactory ( ) <EOL> dd_factory = TMultiplexedProtocolFactory ( binary_factory , DD_SERVICE_NAME ) <EOL> with client_context ( dd_thrift . DingService , '<STR_LIT:127.0.0.1>' , <NUM_LIT> , <EOL> proto_factory = dd_factory ) as c : <EOL> dong = c . ding ( ) <EOL> print ( dong ) <EOL> pp_factory = TMultiplexedProtocolFactory ( binary_factory , PP_SERVICE_NAME ) <EOL> with client_context ( pp_thrift . PingService , '<STR_LIT:127.0.0.1>' , <NUM_LIT> , <EOL> proto_factory = pp_factory ) as c : <EOL> pong = c . ping ( ) <EOL> print ( pong ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
