Skip to content

Instantly share code, notes, and snippets.

@bgweber
Created April 5, 2020 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgweber/7f6693ab831c85b207302d5c2349c5ff to your computer and use it in GitHub Desktop.
Save bgweber/7f6693ab831c85b207302d5c2349c5ff to your computer and use it in GitHub Desktop.
from flask import Flask
from flask_httpauth import HTTPTokenAuth
app = Flask(__name__)
auth = HTTPTokenAuth(scheme='Token')
@auth.verify_token
def verify_token(token):
return '1234567890abcdefg' == token
@app.route('/', methods=["GET","POST"])
@auth.login_required
def index():
return "Hello World!"
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment