Skip to content
This repository has been archived by the owner on Oct 3, 2018. It is now read-only.
/ apistar_request_id Public archive

Request id generation and propagation for API Star.

License

Notifications You must be signed in to change notification settings

Bogdanp/apistar_request_id

Repository files navigation

apistar_request_id

Request id generation and propagation for API Star.

Requirements

Installation

Use pipenv (or plain pip) to install the package:

pipenv install apistar_request_id

Usage

from apistar import App
from apistar_request_id import RequestIdHooks


routes = [
    ...
]

event_hooks = [RequestIdHooks()]

app = App(routes=routes, event_hooks=event_hooks)

All responses will automatically include an x-request-id header once you do this. The request id is inherited from the request if an x-request-id header is set, otherwise one is automatically generated from a uuid.

If you need to access the current request id from application code, you can do so via the RequestId class:

from apistar_request_id import RequestId

print(RequestId.get_request_id())

Request ids are thread-local.

License

apistar_request_id is licensed under Apache 2.0. Please see LICENSE for licensing details.

About

Request id generation and propagation for API Star.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages