Skip to main content

Thriftpy instruments for passing metadata

Project description

Thriftpy instruments for passing metadata bidirectional.


# Server
class Ctx(object):
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 ='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

Download files

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

Files for takumi-thrift, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size takumi_thrift-0.2.2-py2.py3-none-any.whl (8.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size takumi_thrift-0.2.2.tar.gz (5.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page