Last active
January 2, 2020 21:50
-
-
Save alvadorn/68654f4ae444634849ec2024f95cb023 to your computer and use it in GitHub Desktop.
middleware for flask example
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
| from flask import Flask, abort | |
| app = Flask() | |
| @app.before_request | |
| def auth_middleware(): | |
| if not is_authenticated(user): // do your own checker | |
| abort(401) | |
| @app.route('/') | |
| def hello(): | |
| pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment