From 3cf70771cb45cc16ec33ffe44e7a1a4799d8f395 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 23 Jun 2020 23:18:07 +0200 Subject: adding web app base --- animism-align/cli/app/server/representations.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 animism-align/cli/app/server/representations.py (limited to 'animism-align/cli/app/server/representations.py') diff --git a/animism-align/cli/app/server/representations.py b/animism-align/cli/app/server/representations.py new file mode 100644 index 0000000..76d9ed4 --- /dev/null +++ b/animism-align/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