# # Autogenerated by Thrift # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @generated # from __future__ import absolute_import import sys from thrift.util.Recursive import fix_spec from thrift.Thrift import TType, TMessageType, TPriority, TRequestContext, TProcessorEventHandler, TServerInterface, TProcessor, TException, TApplicationException, UnimplementedTypedef from thrift.protocol.TProtocol import TProtocolException from json import loads import sys if sys.version_info[0] >= 3: long = int from .ttypes import UTF8STRINGS, MyEnum, HackEnum, MyStruct, MyDataItem, MyUnion, ReservedKeyword, UnionToBeRenamed from thrift.Thrift import TProcessor import pprint import warnings from thrift import Thrift from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from thrift.protocol import TCompactProtocol from thrift.protocol import THeaderProtocol fastproto = None try: from thrift.protocol import fastproto except ImportError: pass def __EXPAND_THRIFT_SPEC(spec): next_id = 0 for item in spec: if next_id >= 0 and item[0] < 0: next_id = item[0] if item[0] != next_id: for _ in range(next_id, item[0]): yield None yield item next_id = item[0] + 1 class ThriftEnumWrapper(int): def __new__(cls, enum_class, value): return super().__new__(cls, value) def __init__(self, enum_class, value): self.enum_class = enum_class def __repr__(self): return self.enum_class.__name__ + '.' + self.enum_class._VALUES_TO_NAMES[self] all_structs = [] UTF8STRINGS = bool(0) or sys.version_info.major >= 3 from thrift.util.Decorators import ( future_process_main, future_process_method, process_main as thrift_process_main, process_method as thrift_process_method, should_run_on_thread, write_results_after_future, ) class Iface: def getDataByKey0(self, key=None): r""" Parameters: - key """ pass def getDataByKey1(self, key=None): r""" Parameters: - key """ pass class ContextIface: def getDataByKey0(self, handler_ctx, key=None): r""" Parameters: - key """ pass def getDataByKey1(self, handler_ctx, key=None): r""" Parameters: - key """ pass # HELPER FUNCTIONS AND STRUCTURES class getDataByKey0_args: r""" Attributes: - key """ thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None __init__ = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break if fid == 1: if ftype == TType.STRING: self.key = iprot.readString().decode('utf-8') if UTF8STRINGS else iprot.readString() else: iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('getDataByKey0_args') if self.key != None: oprot.writeFieldBegin('key', TType.STRING, 1) oprot.writeString(self.key.encode('utf-8')) if UTF8STRINGS and not isinstance(self.key, bytes) else oprot.writeString(self.key) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def readFromJson(self, json, is_text=True, **kwargs): kwargs_copy = dict(kwargs) relax_enum_validation = bool(kwargs_copy.pop('relax_enum_validation', False)) set_cls = kwargs_copy.pop('custom_set_cls', set) dict_cls = kwargs_copy.pop('custom_dict_cls', dict) wrap_enum_constants = kwargs_copy.pop('wrap_enum_constants', False) if wrap_enum_constants and relax_enum_validation: raise ValueError( 'wrap_enum_constants cannot be used together with relax_enum_validation' ) if kwargs_copy: extra_kwargs = ', '.join(kwargs_copy.keys()) raise ValueError( 'Unexpected keyword arguments: ' + extra_kwargs ) json_obj = json if is_text: json_obj = loads(json) if 'key' in json_obj and json_obj['key'] is not None: self.key = json_obj['key'] def __repr__(self): L = [] padding = ' ' * 4 if self.key is not None: value = pprint.pformat(self.key, indent=0) value = padding.join(value.splitlines(True)) L.append(' key=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( 'key', ) __hash__ = object.__hash__ all_structs.append(getDataByKey0_args) getDataByKey0_args.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (1, TType.STRING, 'key', True, None, 2, ), # 1 ))) getDataByKey0_args.thrift_struct_annotations = { } getDataByKey0_args.thrift_field_annotations = { } def getDataByKey0_args__init__(self, key=None,): self.key = key getDataByKey0_args.__init__ = getDataByKey0_args__init__ def getDataByKey0_args__setstate__(self, state): state.setdefault('key', None) self.__dict__ = state getDataByKey0_args.__getstate__ = lambda self: self.__dict__.copy() getDataByKey0_args.__setstate__ = getDataByKey0_args__setstate__ class getDataByKey0_result: r""" Attributes: - success """ thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None __init__ = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break if fid == 0: if ftype == TType.STRING: self.success = iprot.readString() else: iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('getDataByKey0_result') if self.success != None: oprot.writeFieldBegin('success', TType.STRING, 0) oprot.writeString(self.success) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def readFromJson(self, json, is_text=True, **kwargs): kwargs_copy = dict(kwargs) relax_enum_validation = bool(kwargs_copy.pop('relax_enum_validation', False)) set_cls = kwargs_copy.pop('custom_set_cls', set) dict_cls = kwargs_copy.pop('custom_dict_cls', dict) wrap_enum_constants = kwargs_copy.pop('wrap_enum_constants', False) if wrap_enum_constants and relax_enum_validation: raise ValueError( 'wrap_enum_constants cannot be used together with relax_enum_validation' ) if kwargs_copy: extra_kwargs = ', '.join(kwargs_copy.keys()) raise ValueError( 'Unexpected keyword arguments: ' + extra_kwargs ) json_obj = json if is_text: json_obj = loads(json) if 'success' in json_obj and json_obj['success'] is not None: self.success = json_obj['success'] def __repr__(self): L = [] padding = ' ' * 4 if self.success is not None: value = pprint.pformat(self.success, indent=0) value = padding.join(value.splitlines(True)) L.append(' success=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( 'success', ) __hash__ = object.__hash__ all_structs.append(getDataByKey0_result) getDataByKey0_result.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (0, TType.STRING, 'success', False, None, 2, ), # 0 ))) getDataByKey0_result.thrift_struct_annotations = { } getDataByKey0_result.thrift_field_annotations = { } def getDataByKey0_result__init__(self, success=None,): self.success = success getDataByKey0_result.__init__ = getDataByKey0_result__init__ def getDataByKey0_result__setstate__(self, state): state.setdefault('success', None) self.__dict__ = state getDataByKey0_result.__getstate__ = lambda self: self.__dict__.copy() getDataByKey0_result.__setstate__ = getDataByKey0_result__setstate__ class getDataByKey1_args: r""" Attributes: - key """ thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None __init__ = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break if fid == 1: if ftype == TType.STRING: self.key = iprot.readString().decode('utf-8') if UTF8STRINGS else iprot.readString() else: iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('getDataByKey1_args') if self.key != None: oprot.writeFieldBegin('key', TType.STRING, 1) oprot.writeString(self.key.encode('utf-8')) if UTF8STRINGS and not isinstance(self.key, bytes) else oprot.writeString(self.key) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def readFromJson(self, json, is_text=True, **kwargs): kwargs_copy = dict(kwargs) relax_enum_validation = bool(kwargs_copy.pop('relax_enum_validation', False)) set_cls = kwargs_copy.pop('custom_set_cls', set) dict_cls = kwargs_copy.pop('custom_dict_cls', dict) wrap_enum_constants = kwargs_copy.pop('wrap_enum_constants', False) if wrap_enum_constants and relax_enum_validation: raise ValueError( 'wrap_enum_constants cannot be used together with relax_enum_validation' ) if kwargs_copy: extra_kwargs = ', '.join(kwargs_copy.keys()) raise ValueError( 'Unexpected keyword arguments: ' + extra_kwargs ) json_obj = json if is_text: json_obj = loads(json) if 'key' in json_obj and json_obj['key'] is not None: self.key = json_obj['key'] def __repr__(self): L = [] padding = ' ' * 4 if self.key is not None: value = pprint.pformat(self.key, indent=0) value = padding.join(value.splitlines(True)) L.append(' key=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( 'key', ) __hash__ = object.__hash__ all_structs.append(getDataByKey1_args) getDataByKey1_args.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (1, TType.STRING, 'key', True, None, 2, ), # 1 ))) getDataByKey1_args.thrift_struct_annotations = { } getDataByKey1_args.thrift_field_annotations = { } def getDataByKey1_args__init__(self, key=None,): self.key = key getDataByKey1_args.__init__ = getDataByKey1_args__init__ def getDataByKey1_args__setstate__(self, state): state.setdefault('key', None) self.__dict__ = state getDataByKey1_args.__getstate__ = lambda self: self.__dict__.copy() getDataByKey1_args.__setstate__ = getDataByKey1_args__setstate__ class getDataByKey1_result: r""" Attributes: - success """ thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None __init__ = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break if fid == 0: if ftype == TType.STRING: self.success = iprot.readString() else: iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('getDataByKey1_result') if self.success != None: oprot.writeFieldBegin('success', TType.STRING, 0) oprot.writeString(self.success) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def readFromJson(self, json, is_text=True, **kwargs): kwargs_copy = dict(kwargs) relax_enum_validation = bool(kwargs_copy.pop('relax_enum_validation', False)) set_cls = kwargs_copy.pop('custom_set_cls', set) dict_cls = kwargs_copy.pop('custom_dict_cls', dict) wrap_enum_constants = kwargs_copy.pop('wrap_enum_constants', False) if wrap_enum_constants and relax_enum_validation: raise ValueError( 'wrap_enum_constants cannot be used together with relax_enum_validation' ) if kwargs_copy: extra_kwargs = ', '.join(kwargs_copy.keys()) raise ValueError( 'Unexpected keyword arguments: ' + extra_kwargs ) json_obj = json if is_text: json_obj = loads(json) if 'success' in json_obj and json_obj['success'] is not None: self.success = json_obj['success'] def __repr__(self): L = [] padding = ' ' * 4 if self.success is not None: value = pprint.pformat(self.success, indent=0) value = padding.join(value.splitlines(True)) L.append(' success=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( 'success', ) __hash__ = object.__hash__ all_structs.append(getDataByKey1_result) getDataByKey1_result.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (0, TType.STRING, 'success', False, None, 2, ), # 0 ))) getDataByKey1_result.thrift_struct_annotations = { } getDataByKey1_result.thrift_field_annotations = { } def getDataByKey1_result__init__(self, success=None,): self.success = success getDataByKey1_result.__init__ = getDataByKey1_result__init__ def getDataByKey1_result__setstate__(self, state): state.setdefault('success', None) self.__dict__ = state getDataByKey1_result.__getstate__ = lambda self: self.__dict__.copy() getDataByKey1_result.__setstate__ = getDataByKey1_result__setstate__ class Client(Iface): _fbthrift_force_cpp_transport = False def __enter__(self): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.__enter__() return self def __exit__(self, type, value, tb): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.__exit__(type, value, tb) if self._iprot: self._iprot.trans.close() if self._oprot and self._iprot is not self._oprot: self._oprot.trans.close() def __init__(self, iprot=None, oprot=None, cpp_transport=None): self._iprot = self._oprot = iprot if oprot != None: self._oprot = oprot self._seqid = 0 self._fbthrift_cpp_transport = cpp_transport def set_persistent_header(self, key, value): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.set_persistent_header(key, value) else: try: self._oprot.trans.set_persistent_header(key, value) except AttributeError: pass def get_persistent_headers(self): if self._fbthrift_cpp_transport: return self._fbthrift_cpp_transport.get_persistent_headers() try: return self._oprot.trans.get_write_persistent_headers() except AttributeError: return {} def clear_persistent_headers(self): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.clear_persistent_headers() else: try: self._oprot.trans.clear_persistent_headers() except AttributeError: pass def set_onetime_header(self, key, value): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.set_onetime_header(key, value) else: try: self._oprot.trans.set_header(key, value) except AttributeError: pass def get_last_response_headers(self): if self._fbthrift_cpp_transport: return self._fbthrift_cpp_transport.get_last_response_headers() try: return self._iprot.trans.get_headers() except AttributeError: return {} def set_max_frame_size(self, size): if self._fbthrift_cpp_transport: pass else: try: self._oprot.trans.set_max_frame_size(size) except AttributeError: pass def getDataByKey0(self, key=None): r""" Parameters: - key """ if (self._fbthrift_cpp_transport): args = getDataByKey0_args() args.key = key result = self._fbthrift_cpp_transport._send_request("DbMixedStackArguments", "getDataByKey0", args, getDataByKey0_result) if result.success is not None: return result.success raise TApplicationException(TApplicationException.MISSING_RESULT) self.send_getDataByKey0(key) return self.recv_getDataByKey0() def send_getDataByKey0(self, key=None): self._oprot.writeMessageBegin('getDataByKey0', TMessageType.CALL, self._seqid) args = getDataByKey0_args() args.key = key args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() def recv_getDataByKey0(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x result = getDataByKey0_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "getDataByKey0 failed: unknown result"); def getDataByKey1(self, key=None): r""" Parameters: - key """ if (self._fbthrift_cpp_transport): args = getDataByKey1_args() args.key = key result = self._fbthrift_cpp_transport._send_request("DbMixedStackArguments", "getDataByKey1", args, getDataByKey1_result) if result.success is not None: return result.success raise TApplicationException(TApplicationException.MISSING_RESULT) self.send_getDataByKey1(key) return self.recv_getDataByKey1() def send_getDataByKey1(self, key=None): self._oprot.writeMessageBegin('getDataByKey1', TMessageType.CALL, self._seqid) args = getDataByKey1_args() args.key = key args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() def recv_getDataByKey1(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x result = getDataByKey1_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "getDataByKey1 failed: unknown result"); class Processor(Iface, TProcessor): _onewayMethods = () def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["getDataByKey0"] = Processor.process_getDataByKey0 self._priorityMap["getDataByKey0"] = TPriority.NORMAL self._processMap["getDataByKey1"] = Processor.process_getDataByKey1 self._priorityMap["getDataByKey1"] = TPriority.NORMAL def onewayMethods(self): l = [] l.extend(Processor._onewayMethods) return tuple(l) @thrift_process_main() def process(self,): pass @thrift_process_method(getDataByKey0_args, oneway=False) def process_getDataByKey0(self, args, handler_ctx): result = getDataByKey0_result() try: result.success = self._handler.getDataByKey0(args.key) except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'getDataByKey0', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @thrift_process_method(getDataByKey1_args, oneway=False) def process_getDataByKey1(self, args, handler_ctx): result = getDataByKey1_result() try: result.success = self._handler.getDataByKey1(args.key) except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'getDataByKey1', ex) result = Thrift.TApplicationException(message=repr(ex)) return result Iface._processor_type = Processor class ContextProcessor(ContextIface, TProcessor): _onewayMethods = () def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["getDataByKey0"] = ContextProcessor.process_getDataByKey0 self._priorityMap["getDataByKey0"] = TPriority.NORMAL self._processMap["getDataByKey1"] = ContextProcessor.process_getDataByKey1 self._priorityMap["getDataByKey1"] = TPriority.NORMAL def onewayMethods(self): l = [] l.extend(ContextProcessor._onewayMethods) return tuple(l) @thrift_process_main() def process(self,): pass @thrift_process_method(getDataByKey0_args, oneway=False) def process_getDataByKey0(self, args, handler_ctx): result = getDataByKey0_result() try: result.success = self._handler.getDataByKey0(handler_ctx, args.key) except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'getDataByKey0', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @thrift_process_method(getDataByKey1_args, oneway=False) def process_getDataByKey1(self, args, handler_ctx): result = getDataByKey1_result() try: result.success = self._handler.getDataByKey1(handler_ctx, args.key) except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'getDataByKey1', ex) result = Thrift.TApplicationException(message=repr(ex)) return result ContextIface._processor_type = ContextProcessor fix_spec(all_structs) del all_structs