当前位置: 首页>>代码示例>>Python>>正文


Python TBinaryProtocol.TBinaryProtocolFactory方法代码示例

本文整理汇总了Python中thrift.protocol.TBinaryProtocol.TBinaryProtocolFactory方法的典型用法代码示例。如果您正苦于以下问题:Python TBinaryProtocol.TBinaryProtocolFactory方法的具体用法?Python TBinaryProtocol.TBinaryProtocolFactory怎么用?Python TBinaryProtocol.TBinaryProtocolFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thrift.protocol.TBinaryProtocol的用法示例。


在下文中一共展示了TBinaryProtocol.TBinaryProtocolFactory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def __init__(self,
                 processor,
                 lsocket,
                 inputProtocolFactory=None,
                 outputProtocolFactory=None,
                 threads=10):
        self.processor = processor
        self.socket = lsocket
        self.in_protocol = inputProtocolFactory or TBinaryProtocolFactory()
        self.out_protocol = outputProtocolFactory or self.in_protocol
        self.threads = int(threads)
        self.clients = {}
        self.tasks = Queue.Queue()
        self._read, self._write = socket.socketpair()
        self.prepared = False
        self._stop = False 
开发者ID:XiaoMi,项目名称:galaxy-sdk-python,代码行数:18,代码来源:TNonblockingServer.py

示例2: __init__

# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def __init__(self,
                 processor,
                 lsocket,
                 inputProtocolFactory=None,
                 outputProtocolFactory=None,
                 threads=10):
        self.processor = processor
        self.socket = lsocket
        self.in_protocol = inputProtocolFactory or TBinaryProtocolFactory()
        self.out_protocol = outputProtocolFactory or self.in_protocol
        self.threads = int(threads)
        self.clients = {}
        self.tasks = queue.Queue()
        self._read, self._write = socket.socketpair()
        self.prepared = False
        self._stop = False 
开发者ID:Aditmadzs,项目名称:Protect4,代码行数:18,代码来源:TNonblockingServer.py

示例3: prepareClient

# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def prepareClient(client, username, password):
    yield client.authenticate(username, password)

    channel = yield client.channel(1)

    yield channel.channel_open()
    yield channel.exchange_declare(exchange=servicesExchange, type="direct")
    yield channel.exchange_declare(exchange=responsesExchange, type="direct")

    pfactory = TBinaryProtocol.TBinaryProtocolFactory()

    # To trigger an unroutable message error (caught in the above
    # gotTransportError errback), change the routing key (i.e.,
    # calculatorKey) in the following to be something invalid, like
    # calculatorKey + 'xxx'.
    thriftClient = yield client.createThriftClient(responsesExchange,
        servicesExchange, calculatorKey, tutorial.Calculator.Client,
        iprot_factory=pfactory, oprot_factory=pfactory)
    
    defer.returnValue(thriftClient) 
开发者ID:txamqp,项目名称:txamqp,代码行数:22,代码来源:client.py

示例4: __init__

# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def __init__(self, *args):
    if (len(args) == 2):
      self.__initArgs__(args[0], args[1],
                        TTransport.TTransportFactoryBase(),
                        TTransport.TTransportFactoryBase(),
                        TBinaryProtocol.TBinaryProtocolFactory(),
                        TBinaryProtocol.TBinaryProtocolFactory())
    elif (len(args) == 4):
      self.__initArgs__(args[0], args[1], args[2], args[2], args[3], args[3])
    elif (len(args) == 6):
      self.__initArgs__(args[0], args[1], args[2], args[3], args[4], args[5]) 
开发者ID:XiaoMi,项目名称:galaxy-sdk-python,代码行数:13,代码来源:TServer.py

示例5: __init__

# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def __init__(self, *args):
        if (len(args) == 2):
            self.__initArgs__(args[0], args[1],
                              TTransport.TTransportFactoryBase(),
                              TTransport.TTransportFactoryBase(),
                              TBinaryProtocol.TBinaryProtocolFactory(),
                              TBinaryProtocol.TBinaryProtocolFactory())
        elif (len(args) == 4):
            self.__initArgs__(args[0], args[1], args[2], args[2], args[3], args[3])
        elif (len(args) == 6):
            self.__initArgs__(args[0], args[1], args[2], args[3], args[4], args[5]) 
开发者ID:Aditmadzs,项目名称:Protect4,代码行数:13,代码来源:TServer.py

示例6: prepareClient

# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def prepareClient(client, username, password):
    yield client.authenticate(username, password)

    handler = CalculatorHandler()
    processor = tutorial.Calculator.Processor(handler)
    pfactory = TBinaryProtocol.TBinaryProtocolFactory()

    yield client.createThriftServer(responsesExchange, servicesExchange,
        calculatorKey, processor, calculatorQueue, iprot_factory=pfactory,
        oprot_factory=pfactory) 
开发者ID:txamqp,项目名称:txamqp,代码行数:12,代码来源:server.py

示例7: init_pool

# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def init_pool(self):
        return PoolClient(Client, TStreamPool(self.host, self.port, max_stream=self.max_stream), TBinaryProtocolFactory()) 
开发者ID:snower,项目名称:forsun,代码行数:4,代码来源:__init__.py

示例8: get_client

# 需要导入模块: from thrift.protocol import TBinaryProtocol [as 别名]
# 或者: from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory [as 别名]
def get_client(self, host, port, max_connections = 0):
        key = "%s:%s" % (host, port)
        if key not in self.client_pools:
            self.__class__.client_pools[key] = PoolClient(Client, TStreamPool(host, port, max_stream=max_connections), TBinaryProtocolFactory())
        elif max_connections:
            self.client_pools[key]._itrans_pool._max_stream = max_connections
        return self.client_pools[key] 
开发者ID:snower,项目名称:forsun,代码行数:9,代码来源:thriftaction.py


注:本文中的thrift.protocol.TBinaryProtocol.TBinaryProtocolFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。