takumi-http
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.
Config
thrift_protocol_class: takumi_http.HttpProtocol
Settings
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.
Example
from takumi import Takumi
app = Takumi('PingService')
app.use(save_session)
@app.api_with_ctx
@pass_request
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:
http://<domain>:<port>/<arbitrary>/<api_name>
Metadata
Release files for takumi-http 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| takumi_http-0.1.7.tar.gz | 9.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| takumi_http-0.1.7-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 23.4 kB
Release files / takumi_http-0.1.7.tar.gz
| Download URL | takumi_http-0.1.7.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d63651f0853ec5194cbfb2d91aef64b138ede433d685ef2e6694cac0af963ae0
|
|
BLAKE2b-256 checksum How to use checksums |
2a1fbbb2b516d1f1320eb841c202220f46a891d4d5a8e967af0d4e07c5a48493
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.1
|
Release files / takumi_http-0.1.7-py2.py3-none-any.whl
| Download URL | takumi_http-0.1.7-py2.py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
cfdc510735f744f280deec99f587e8afbbc4e01b7cb9aaa8562860063a46d61b
|
|
BLAKE2b-256 checksum How to use checksums |
86e019c64ea15166f51adc49b5b5e59fcad17d95d55a807561a2c14aae9b40d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.1
|
Security for takumi-http 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.