Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Packages

No packages published

Languages