Skip to content

Commit 22cc283

Browse files
authored
Merge pull request #63 from seiflotfy/python-update
Add support for stdout and convert results to json
2 parents d883e4b + 19c4a28 commit 22cc283

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

images/python/bootstrap.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ def filter(self, record):
241241
stopWithError("Failed to read {payloadFileName}. err={err}".format(payloadFileName=(payloadFileName or '<stdin>'), err=e))
242242

243243
try:
244-
payload = json.loads(payload)
244+
if len(payload) > 0:
245+
payload = json.loads(payload)
245246
except:
246247
debugging and print ('payload is ') and print (payload)
247248
stopWithError('Payload is not JSON')
@@ -261,7 +262,7 @@ def filter(self, record):
261262

262263
try:
263264
result = caller.call(payload, context)
264-
#FIXME where to put result in async mode?
265+
sys.stdout.write(json.dumps(result))
265266
except Exception as e:
266267
stopWithError(e)
267268

0 commit comments

Comments
 (0)