Skip to main content

Http to thrift protocol conversion

Project description

Write http service as a thrift service.

This package implements a protocol transformer from http to thrift. Just write the service as a normal Takumi thrift service, then serve the service as a http service. The developers don’t have to care about the details of the protocol transformation, only add the config thrift_protocol_class to app.yaml and your service can be served as a http service.


thrift_protocol_class: takumi_http.HttpProtocol


Session related settings:

  • SECRET_KEY (required) secret key for encrypting cookies.

  • PERMANENT_SESSION_LIFETIME timedelta of session lifetime, default 31 day.

  • SESSION_COOKIE_DOMAIN cookie domain.

  • SESSION_COOKIE_PATH cookie path, default ‘/’.

The attributes session_cookie_domain and session_cookie_path can be setted to api context to override default settings.


from takumi import Takumi

app = Takumi('PingService')

def say_hello(request, name):
    request.session['user_id'] = 90
    return 'Hello ' + name

Serve the App

Using takumi-cli to the serve the app.

$ takumi serve

Invoke Api

The http method is not very important. If the api has arguments use POST, if not use GET.

Use a http client to invoke api:

$ curl -XPOST http://localhost:1993/say_hello -d '{"name":"world"}'

API URL has this format:


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_http-0.1.7.tar.gz (9.7 kB view hashes)

Uploaded Source

Built Distribution

takumi_http-0.1.7-py2.py3-none-any.whl (13.7 kB view hashes)

Uploaded Python 2 Python 3

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