2019-06-22 18:37:16 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
"""
|
|
|
|
Miscellaneous tools and helper functions.
|
|
|
|
"""
|
2019-11-08 13:11:57 -05:00
|
|
|
from aiohttp import web
|
2019-06-22 18:37:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
def make_error(code, message):
|
|
|
|
"""
|
|
|
|
Returns a JSON error.
|
|
|
|
"""
|
2019-11-08 13:11:57 -05:00
|
|
|
d = {'ok': False, 'status': code, 'message': message}
|
|
|
|
res = web.json_response(d)
|
|
|
|
res.set_status(code)
|
2019-06-22 18:37:16 -04:00
|
|
|
return res
|