-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathhandler.py
More file actions
31 lines (24 loc) · 877 Bytes
/
handler.py
File metadata and controls
31 lines (24 loc) · 877 Bytes
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
def handler(event, context):
"""Lambda handler that will get invoked by the LocalStack runtime"""
# wait for the debugger to get attached
wait_for_debug_client()
# print the incoming invocation event
print(event)
def wait_for_debug_client(timeout=15):
"""Utility function to enable debugging with Visual Studio Code"""
import time, threading
import sys, glob
sys.path.append(glob.glob(".venv/lib/python*/site-packages")[0])
import debugpy
debugpy.listen(("0.0.0.0", 19891))
class T(threading.Thread):
daemon = True
def run(self):
time.sleep(timeout)
print("Canceling debug wait task ...")
debugpy.wait_for_client.cancel()
T().start()
print("Waiting for client to attach debugger ...")
debugpy.wait_for_client()
if __name__ == "__main__":
handler({}, {})