Skip to content

Instantly share code, notes, and snippets.

@debovis
Last active August 29, 2015 14:10
Show Gist options
  • Save debovis/5e3e8bb4e1d748d0ee9e to your computer and use it in GitHub Desktop.
Save debovis/5e3e8bb4e1d748d0ee9e to your computer and use it in GitHub Desktop.
Python Flask return JSON Response Exception
json_headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
res = Response(headers=json_headers)
res.set_data(data)
res.status_code = 400
raise abort(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment