Skip to content

Instantly share code, notes, and snippets.

@viveksb007
Created February 1, 2018 11:58
Show Gist options
  • Save viveksb007/4e6cc748bfe32a7f656fcb7ed6f3b9df to your computer and use it in GitHub Desktop.
Save viveksb007/4e6cc748bfe32a7f656fcb7ed6f3b9df to your computer and use it in GitHub Desktop.
from flask import Response
import json
@app.route('/response', methods=['GET'])
def api_response():
data = {
'data': 'test data',
'id': 1
}
js = json.dumps(data)
resp = Response(js, status=200, mimetype='application/json')
return resp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment