-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
30 lines (26 loc) · 893 Bytes
/
app.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
import logging
import traceback
logger = logging.getLogger()
def lambda_handler(event, context):
try:
if "ELB-HealthChecker" in event.get("headers").get("user-agent"):
return {
"statusCode": 200,
"statusDescription": "200 OK",
"isBase64Encoded": False,
"headers": {
"Content-Type": "text/html; charset=utf-8"
}
}
else:
return {
"statusCode": 401,
"statusDescription": "401 Unauthorized",
"isBase64Encoded": False,
"headers": {
"WWW-Authenticate": "Basic",
"Content-Type": "text/html; charset=utf-8"
}
}
except Exception:
logger.error({"event": event, "traceback": traceback.format_exc()})