How do I raise HTTP errors as JSON?
My attempt:
In [1]: import json
In [2]: from gluon.http import HTTP
In [3]: raise HTTP(412, json.dumps({'error': 'must accept terms'}))
---------------------------------------------------------------------------
HTTP Traceback (most recent call last)
<ipython-input-11-4878ff8c2cfc> in <module>()
----> 1 raise HTTP(412, json.dumps({'error': 'must accept terms'}))
HTTP: 412 PRECONDITION FAILED
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.