0 Star 1 Fork 0

throwable / python-thrift-pool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
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")

空文件

简介

Python Thrift pool base on python2.7 展开 收起
Python
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/hand515/python-thrift-pool.git
git@gitee.com:hand515/python-thrift-pool.git
hand515
python-thrift-pool
python-thrift-pool
master

搜索帮助