Created
March 30, 2019 06:56
-
-
Save shahbaz17/a7f89a8470acc09d2188171311c295ad to your computer and use it in GitHub Desktop.
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 | |
from flask import jsonify | |
from flask import request | |
from flask import make_response | |
app = Flask(__name__) | |
@app.route('/login') | |
def login(): | |
auth = request.authorization | |
if auth and auth.password == 'hestia': | |
return jsonify({'message' : 'logged in'}) | |
return make_response('Could not verify!', 401, | |
{'WWW-Authenticate' : | |
'Basic realm:"Login Required"'}) | |
if __name__ == "__main__": | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment