mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Example app structure. round 1.
This commit is contained in:
21
examples/app/python/func.py
Normal file
21
examples/app/python/func.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
sys.stderr.write("Starting Python Function\n")
|
||||
|
||||
name = "I speak Python too"
|
||||
|
||||
try:
|
||||
if not os.isatty(sys.stdin.fileno()):
|
||||
try:
|
||||
obj = json.loads(sys.stdin.read())
|
||||
if obj["name"] != "":
|
||||
name = obj["name"]
|
||||
except ValueError:
|
||||
# ignore it
|
||||
sys.stderr.write("no input, but that's ok\n")
|
||||
except:
|
||||
pass
|
||||
|
||||
print "Hello, " + name + "!"
|
||||
Reference in New Issue
Block a user