From 0890fdd951d021308550a0db2e7b6f2593512957 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 30 May 2020 17:27:04 +0200 Subject: initial site copied in --- cli/app/server/representations.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cli/app/server/representations.py (limited to 'cli/app/server/representations.py') diff --git a/cli/app/server/representations.py b/cli/app/server/representations.py new file mode 100644 index 0000000..76d9ed4 --- /dev/null +++ b/cli/app/server/representations.py @@ -0,0 +1,12 @@ +import simplejson as json +from flask import make_response + +def output_json(data, code, headers=None): + content_type = 'application/json' + dumped = json.dumps(data) + if headers: + headers.update({'Content-Type': content_type}) + else: + headers = {'Content-Type': content_type} + response = make_response(dumped, code, headers) + return response -- cgit v1.2.3-70-g09d2