Open
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Original file line numberDiff line numberDiff line change
Expand Up@@ -129,3 +129,8 @@ The output will be like:
None
[root - INFO - 2017-04-19 12:39:05,515] REPORT RequestId: b918f9ae-0ca1-44af-9937-dd5f9eeedcc1 Duration: 2.27 ms
```

#### Dynamic events:

Instead of an event.json file, any executable can be passed to `python-lambda-local` as the event path.
In this case, it will be executed, and its stdout will be used as the event.
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,10 +4,16 @@
'''

import json
import os
import subprocess


def read_event(path):
with open(path) as event:
data = json.load(event)
if os.path.isfile(path) and os.access(path, os.X_OK):
r = subprocess.run(path, stdout=subprocess.PIPE)
data = json.loads(r.stdout)
else:
with open(path) as event:
data = json.load(event)

return data