INNER CODE UNIT · Python
_json_response
adeekshith/watomatic · aws/lambda_function.py:50
def _json_response(status_code, body):
return {
"statusCode": status_code,
"headers": {"Content-Type": "application/json"},
"body": json.dumps(body),
}
def _post_json(url, body, headers, timeout=10):
resp = _http.request(
"POST",
url,
body=json.dumps(body).encode("utf-8"),
headers=headers,
timeout=timeout,
)
data = resp.data.decode("utf-8")