Created
March 16, 2015 20:47
-
-
Save mitchty/1c60c9f4e4df515eeb08 to your computer and use it in GitHub Desktop.
flask uuid tracking per request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Per request uuid tracking in flask, or at least one way to go about it. | |
In create_app() | |
@app.before_request | |
def add_uuid_to_request_object(): | |
request.uuid = uuid.uuid4() | |
Then in your route or MethodViews, I'm using MethodViews: | |
class SomeAPI(MethodView): | |
def get(self): | |
current_app.loggers.debug("%s etc..." % request.uuid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment