Skip to main content

Thriftpy instruments for passing metadata

Project description

https://travis-ci.org/elemepi/takumi-thrift.svg?branch=master

Thriftpy instruments for passing metadata bidirectional.

Example

# Server
class Ctx(object):
    pass
ctx = Ctx()
ctx.response_meta = {'server': 'test'}

class Handler(object):
    def say_hello(name):
        assert ctx.meta == {'hello': 'test', 'client_name': 'test_client'}
        return Response('Hello ' + name, meta={'api': 'say_hello'})

processor = Processor(ctx, service, Handler())

# Client
client = Client(service, proto, meta={'client_name': 'test_client'})
res = client.call('say_hello', 'world', meta={'hello': 'test'})
assert res.meta == {'api': 'say_hello', 'server': 'test'}
assert res.value == 'Hello world'

Data frame change

Request data frame:

before: message_begin args message_end
after:  meta_begin meta meta_end message_begin args message_end

Response data frame:

before: message_begin result message_end
after:  meta_begin meta meta_end message_begin result message_end

Project details


Release history Release notifications

This version
History Node

0.2.1

History Node

0.2.0

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
takumi_thrift-0.2.1-py2.py3-none-any.whl (8.3 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Apr 17, 2017
takumi_thrift-0.2.1.tar.gz (5.0 kB) Copy SHA256 hash SHA256 Source None Apr 17, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page