1 2 3 4 5 6 7 8 9 10 11 12 13 14
| from flask import jsonify
@app.route('/getcurrentuser') def getcurrent_user(): return jsonify(username=g.user.username, email=g.user.email, id=g.user.id) This will send a JSON response like this to the browser: { "username": "admin", "email": "admin@localhost", "id": 42 }
|