Thrift client pool for Takumi
Project description
Thrift client pool for Takumi.
Install
$ pip install takumi-client
Usage
This module relies on takumi-config for settings.
CLIENT_SETTINGS
service: required, service name defined in thrift file
thrift_file: required, existing thrift file path
pool_size: optional, connection pool size, default 30
timeout: optional, connection timeout, default 30s
check_time: optional, time interval for checking failed connections, default 10s
hosts: optional, a list of hosts: [(‘hostname’, port)]
extra args: vary for different hosts extensions
Example settings:
CLIENT_SETTINGS = {
'demo': {
'service': 'PingService',
'thrift_file': 'ping.thrift',
'hosts': [
('localhost', 1990),
('localhost', 8010),
('localhost', 1890)
]
}
}
To get a pool:
from takumi_client import clients
pool = clients['demo']
To invoke an api:
with pool.client_ctx() as c:
c.ping()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
takumi_client-0.1.2.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for takumi_client-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03dabb813b049fb0c1718a532b3ea9bab192c3a7c9570e67e9f194285d4f709c |
|
MD5 | 008f0a9ca734aa4725d89b1b0835d4aa |
|
BLAKE2b-256 | 2d95bbd2c99e973ce7c5104d54cbaecffc629be811d10c88f251d8404d6b70f9 |