當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。