-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheader.py
32 lines (28 loc) · 865 Bytes
/
header.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import json
import decimal
import time
from itertools import groupby
from functools import reduce
from functools import wraps
import boto3
CORS_HEADERS = {
'headers': {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Credentials': True
}
}
def with_cors(f):
"""Adds CORS headers."""
@wraps(f)
def decorated(*args, **kwargs):
dict_obj = f(*args, **kwargs)
if 'headers' in dict_obj.keys():
dict_obj['headers'].update(CORS_HEADERS['headers'])
else:
dict_obj.update(CORS_HEADERS)
return dict_obj
return decorated
__all__ = ["error_codes", "status", "get_env", "mk_resp", "DecimalEncoder",
"composite", "count_by_status", "with_cors", "dummy_entry",
"move_payload", "get_path", "updatable_functions", "mk_day", "handle_errors"]