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_name: 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)]
hosts_class: optional, alternative class used to load hosts, default takumi_client.hosts.ListHosts
extra args: vary for different hosts classes
Example settings:
CLIENT_SETTINGS = {
'demo': {
'service_name': '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
Built Distribution
Hashes for takumi_client-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d49433d08c2c5580899f89aa2237ac727c56911657563ad7055fd5a8e28c1ce |
|
MD5 | d70b3caac5b4d0da3f307c28d0e62080 |
|
BLAKE2b-256 | 6a801a9ba33f39e62533aa92ea102e6bebc6db412d97d64f43d3e71019ea8546 |