diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-06-23 23:18:07 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-06-23 23:18:07 +0200 |
| commit | 3cf70771cb45cc16ec33ffe44e7a1a4799d8f395 (patch) | |
| tree | 55f0edb53141d5f043b486d722f507bfd94abdea /animism-align/cli/app/server/representations.py | |
| parent | 014816dc724c1be60b7dd28d4e608c89b4ed451c (diff) | |
adding web app base
Diffstat (limited to 'animism-align/cli/app/server/representations.py')
| -rw-r--r-- | animism-align/cli/app/server/representations.py | 12 |
1 files changed, 12 insertions, 0 deletions
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 |
