utils.py 280 B

12345678910
  1. import json
  2. def resp(app, data=None, code=200, headers=None):
  3. if not headers:
  4. headers = {}
  5. if 'Content-Type' not in headers:
  6. headers['Content-Type'] = 'application/json'
  7. data = json.dumps(data)
  8. return app.make_response((data, code, headers))