#
# Autogenerated by Thrift Compiler (0.9.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py:new_style,utf8strings,slots,dynamic
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.protocol.TBase import TBase, TExceptionBase
[docs]class Iface(object):
[docs] def echoString(self, s):
"""
Parameters:
- s
"""
pass
[docs]class Client(Iface):
def __init__(self, iprot, oprot=None):
self._iprot = self._oprot = iprot
if oprot is not None:
self._oprot = oprot
self._seqid = 0
[docs] def ping(self, ):
self.send_ping()
self.recv_ping()
[docs] def send_ping(self, ):
self._oprot.writeMessageBegin('ping', TMessageType.CALL, self._seqid)
args = ping_args()
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
[docs] def recv_ping(self, ):
(fname, mtype, rseqid) = self._iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(self._iprot)
self._iprot.readMessageEnd()
raise x
result = ping_result()
result.read(self._iprot)
self._iprot.readMessageEnd()
return
[docs] def echoString(self, s):
"""
Parameters:
- s
"""
self.send_echoString(s)
return self.recv_echoString()
[docs] def send_echoString(self, s):
self._oprot.writeMessageBegin('echoString', TMessageType.CALL, self._seqid)
args = echoString_args()
args.s = s
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
[docs] def recv_echoString(self, ):
(fname, mtype, rseqid) = self._iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(self._iprot)
self._iprot.readMessageEnd()
raise x
result = echoString_result()
result.read(self._iprot)
self._iprot.readMessageEnd()
if result.success is not None:
return result.success
raise TApplicationException(TApplicationException.MISSING_RESULT, "echoString failed: unknown result");
[docs]class Processor(Iface, TProcessor):
def __init__(self, handler):
self._handler = handler
self._processMap = {}
self._processMap["ping"] = Processor.process_ping
self._processMap["echoString"] = Processor.process_echoString
[docs] def process(self, iprot, oprot):
(name, type, seqid) = iprot.readMessageBegin()
if name not in self._processMap:
iprot.skip(TType.STRUCT)
iprot.readMessageEnd()
x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
x.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
return
else:
self._processMap[name](self, seqid, iprot, oprot)
return True
[docs] def process_ping(self, seqid, iprot, oprot):
args = ping_args()
args.read(iprot)
iprot.readMessageEnd()
result = ping_result()
self._handler.ping()
oprot.writeMessageBegin("ping", TMessageType.REPLY, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
[docs] def process_echoString(self, seqid, iprot, oprot):
args = echoString_args()
args.read(iprot)
iprot.readMessageEnd()
result = echoString_result()
result.success = self._handler.echoString(args.s)
oprot.writeMessageBegin("echoString", TMessageType.REPLY, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
# HELPER FUNCTIONS AND STRUCTURES
[docs]class ping_args(TBase):
__slots__ = [
]
thrift_spec = (
)
[docs]class ping_result(TBase):
__slots__ = [
]
thrift_spec = (
)
[docs]class echoString_args(TBase):
"""
Attributes:
- s
"""
__slots__ = [
's',
]
thrift_spec = (
None, # 0
(1, TType.STRING, 's', None, None, ), # 1
)
def __init__(self, s=None,):
self.s = s
[docs]class echoString_result(TBase):
"""
Attributes:
- success
"""
__slots__ = [
'success',
]
thrift_spec = (
(0, TType.STRING, 'success', None, None, ), # 0
)
def __init__(self, success=None,):
self.success = success