Improve the python code

This commit is contained in:
Jeffrey Linwood
2017-09-18 17:59:08 -05:00
parent 0376862fdc
commit a5e8a25ad8

4
app.py
View File

@@ -62,9 +62,9 @@ def randomToken():
@app.route('/token', methods=['POST'])
def createToken():
# Get the request json or form data
content = request.get_json() if request.get_json() else request.form
content = request.get_json() or request.form
# get the identity from the request, or make one up
identity = content['identity'] if content['identity'] else fake.user_name()
identity = content.get('identity', fake.user_name())
return generateToken(identity)
@app.route('/token/<identity>', methods=['POST', 'GET'])