def do_test(): import TWebsocketClient transport = TWebsocketClient.TWebsocketClient("ws://localhost:8888/thrift") protocol = TJSONProtocol(transport) client = Hello.Client(protocol) transport.open() print client.sayHello() transport.close()
def do_test(): transport = THttpClient.THttpClient('http://localhost:9090') transport = TTransport.TBufferedTransport(transport) protocol = TJSONProtocol.TJSONProtocol(transport) client = Hello.Client(protocol) transport.open() print "server response:", client.sayHello() transport.close()
def main(): transport = TSocket.TSocket('127.0.0.1', 9090) transport = TTransport.TBufferedTransport(transport) protocol = TBinaryProtocol.TBinaryProtocol(transport) client = Hello.Client(protocol) transport.open() print client.hello_string('string') print client.hello_int(123) print client.hello_boolean(True) print client.hello_void() print client.hello_null() transport.close()
def main(): # Make socket transport = TSocket.TSocket('localhost', 5000) # 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 = Hello.Client(protocol) # Connect! transport.open() print(client.ping())