# python-thrift-pool **Repository Path**: hand515/python-thrift-pool ## Basic Information - **Project Name**: python-thrift-pool - **Description**: Python Thrift pool base on python2.7 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2014-02-27 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #python-thrift-pool #base on: * python2.7 * thrift 0.9.2 thrift lib #change 2014-12-05 : * dependency thrift 0.9.2 while using thrift-TMultiplexedProtocol # use it ##install pip install thriftpl ## using pool look at tests/test.py
# -*- coding: utf-8 -*-
import os,sys
from thriftpl.client import ThriftClientPool,ThriftClientConfig,HostAndPort,ThriftPoolConfig
from test import TestService
address = HostAndPort("127.0.0.1",9090)
poolConfig = ThriftPoolConfig(minPoolSize=1,maxPoolSize=10,maxWait=500)
clientConfig = ThriftClientConfig(clientInterface=TestService.Client)
pool = ThriftClientPool(clientConfig,poolConfig,address)
client = pool.getClient()
print client.test("123")
print client.test("1234")
print client.test("1235")
print pool.getClient().test("abc")
print pool.getClient().test("abcd")
print pool.getClient().test("abce")
## only use thrift client
from thriftpl.client import ThriftClient
client = ThriftClient(ip="127.0.0.1", port=9090, timeout=self.clientConfig.timeout,
clientInterface=TestService.Client )
client.test("test")