Пример #1
0
def ping():
    transport = TSocket.TSocket('127.0.0.1', 9099)
    tranport = TTransport.TFramedTransport(transport)
    protocol = TCompactProtocol.TCompactProtocol(tranport)
    client = Ping.Client(protocol)
    tranport.open()
    client.ping()
    tranport.close()
from __future__ import absolute_import

from thrift.transport.THttpClient import THttpClient
from thrift.protocol.TBinaryProtocol import TBinaryProtocolAccelerated

from ping import Ping

trans = THttpClient('http://localhost:8888/thrift')
proto = TBinaryProtocolAccelerated(trans)
client = Ping.Client(proto)

print client.ping('world')
Пример #3
0
 def __init__(self):
     self.transport = TSocket.TSocket('127.0.0.1', 7748)
     self.transport = TTransport.TBufferedTransport(self.transport)
     self.protocol = TBinaryProtocol.TBinaryProtocol(self.transport)
     self.client = Ping.Client(self.protocol)
     self.transport.open()