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


Download files

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

Source Distribution

takumi_thrift-0.2.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

takumi_thrift-0.2.2-py2.py3-none-any.whl (8.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file takumi_thrift-0.2.2.tar.gz.

File metadata

  • Download URL: takumi_thrift-0.2.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.8.1 pkginfo/1.4.1 requests/2.13.0 setuptools/36.2.7 requests-toolbelt/0.7.1 clint/0.5.1 CPython/3.4.3 Darwin/16.7.0

File hashes

Hashes for takumi_thrift-0.2.2.tar.gz
Algorithm Hash digest
SHA256 1d46002819be2a7f86a15a3644b8d9ab46199e2de30f8d37f4421d9eb3b5e57f
MD5 edb029fd095d6ae106dcde36ace55c64
BLAKE2b-256 68375f65ea74339e1979b7bbc0af91b9aa560c90fef86e5633583e1dff266ea1

See more details on using hashes here.

File details

Details for the file takumi_thrift-0.2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: takumi_thrift-0.2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.8.1 pkginfo/1.4.1 requests/2.13.0 setuptools/36.2.7 requests-toolbelt/0.7.1 clint/0.5.1 CPython/3.4.3 Darwin/16.7.0

File hashes

Hashes for takumi_thrift-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 db973e5e19bc47fdcdd1c8c7771726c603c2dac214b51f54bb0f9fa693f0adae
MD5 64f13fad4abf2c248c886c404724d614
BLAKE2b-256 644e80e74a0b7f02bacdf9431e624771bb02090e5dcce6745f747e30e496c0a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page