Python thrift.protocol.TBinaryProtocol.TBinaryProtocolFactory() Examples

The following are 16 code examples of thrift.protocol.TBinaryProtocol.TBinaryProtocolFactory(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module thrift.protocol.TBinaryProtocol , or try the search function .
Example #1
Source File: TNonblockingServer.py    From galaxy-sdk-python with Apache License 2.0 6 votes vote down vote up
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 
Example #2
Source File: TNonblockingServer.py    From Protect4 with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #3
Source File: TNonblockingServer.py    From Aditmadzs2 with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #4
Source File: client.py    From txamqp with Apache License 2.0 6 votes vote down vote up
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) 
Example #5
Source File: TNonblockingServer.py    From ajs2 with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #6
Source File: TNonblockingServer.py    From SOLO with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #7
Source File: TNonblockingServer.py    From thrift with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 
Example #8
Source File: TServer.py    From galaxy-sdk-python with Apache License 2.0 5 votes vote down vote up
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]) 
Example #9
Source File: TServer.py    From Protect4 with GNU General Public License v3.0 5 votes vote down vote up
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]) 
Example #10
Source File: TServer.py    From Aditmadzs2 with GNU General Public License v3.0 5 votes vote down vote up
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]) 
Example #11
Source File: server.py    From txamqp with Apache License 2.0 5 votes vote down vote up
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) 
Example #12
Source File: __init__.py    From forsun with MIT License 5 votes vote down vote up
def init_pool(self):
        return PoolClient(Client, TStreamPool(self.host, self.port, max_stream=self.max_stream), TBinaryProtocolFactory()) 
Example #13
Source File: thriftaction.py    From forsun with MIT License 5 votes vote down vote up
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] 
Example #14
Source File: TServer.py    From ajs2 with GNU General Public License v3.0 5 votes vote down vote up
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]) 
Example #15
Source File: TServer.py    From SOLO with GNU General Public License v3.0 5 votes vote down vote up
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]) 
Example #16
Source File: TServer.py    From thrift with GNU Lesser General Public License v3.0 5 votes vote down vote up
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])