def node_setup(): # Make socket transport = TSocket.TSocket('127.0.0.1', 9091) # Buffering is critical. Raw sockets are very slow transport = TTransport.TBufferedTransport(transport) # Wrap in a protocol' protocol = TBinaryProtocol.TBinaryProtocol(transport) # Create a client to use the protocol encoder client = API.Client(protocol) # Connect! transport.open() return client