19 lines
401 B
Python
19 lines
401 B
Python
|
# standard imports
|
||
|
import json
|
||
|
|
||
|
DEFAULT_HEADERS = [
|
||
|
('Access-Control-Allow-Origin', '*'),
|
||
|
('Content-Type', 'application/json'),
|
||
|
]
|
||
|
|
||
|
|
||
|
def respond(start_response, data):
|
||
|
json_data = json.dumps(data)
|
||
|
content = json_data.encode('utf-8')
|
||
|
headers = [
|
||
|
*DEFAULT_HEADERS,
|
||
|
('Content-Type', 'application/json',)
|
||
|
]
|
||
|
start_response('200 OK', headers)
|
||
|
return [content]
|